10

We have a continuous delivery approach, each feature is pushed to production when it is ready. There can be 1 to 5 deployments per day.

Does it affect Salesforce performance?

I know that yes, but I need more details here. :(

More questions then:

  1. The whole environment is affected or only the classes we are deploying?
  2. What when I deploy classes that are not available for end users yet?
  3. Unit test slows down performance?
  4. What with LWC deployments only? (without unit test) Is it a problem as well?
  5. Do you know how big the impact is?
  6. What metadata types cause performance issues?

As far as I know, the best practice is to do deployments outside business hours or during weekends. However, maybe there are some cases when code can be deployed without any performance problems.

Any answer will be nice! Thanks.

5
  • 3
    No sources to back this up beyond "I heard something like this at Dreamforce once", but... generally yes, it will affect performance for the entire org. Salesforce has some form of bytecode caching that helps performance, but I believe it gets wiped out any time you perform a deployment (and it takes a code execution or two to get it back into the cache). I believe I have also had users experience row lock errors while running tests in production (maybe tied to Custom Settings?)
    – Derek F
    Sep 26, 2022 at 21:23
  • 1
    Hello Piotr - I think this video can help you clarify some of your questions and relates to what Derek F mentioned (I heard something like this at Dreamforce once). Btw this is a bit old 2016: youtu.be/Yc5FrviQqO8 In general unit tests should not slow down performance, but deployments can. Sep 29, 2022 at 8:13
  • 1
    This a bit newer (still 2017) and gets into more details of the rollout and new compiler on its own: salesforce.com/video/1756772 Sep 29, 2022 at 8:15
  • 1
    I also suggest looking at Deploying Apex on Apex Developer Guide: developer.salesforce.com/docs/atlas.en-us.apexcode.meta/… Sep 29, 2022 at 8:20
  • I will check for sure @JefersonChaves! Thank you. Sep 29, 2022 at 10:04

1 Answer 1

9
+50

In Summer '18 we enforced "Compile on deploy" for all production orgs. This is explicitly designed to prevent impacts to end users when new Apex code is deployed.

Previously, the first users accessing the system would have had a slower experience while the Apex code is compiled and the resulting bytecode gets cached.

The execution of Apex tests during the deployment will have no impact on current end users. There are exceptions here for more specialized use cases. E.g. While we are compiling Apex code we hold a lock, which would prevent other operations that need that lock from starting. That would manifest as Organization Administration Locked.


The best practice recommendation to

"avoid high impact changes during critical hours" [Source]

is correct. It will always be the safest approach when there could be a wide range of metadata component types being deployed. Compile on deploy is to minimize any impacts from Apex compilation, but other metadata types could impact the overall system as well.

7
  • Thank you Daniel! One more thing to be sure. We also contact Salesforce Support and they have stated that Salesforce deployments slow down the system and the best practice is to do deployment outside business hours or during weekends. Is it still a valid statement? We mostly deploy a few LWC and a few Apex classes on daily bases. Is it a problem? Based on your answer, it looks - it is not. Correct? Sep 29, 2022 at 20:16
  • Thanks Daniel. By any chance do you know whether deploying other metadata components (non-Apex) like experience bundles / objects / flows / profiles / aura components and others have any impact on performance and end users' experience? Sep 29, 2022 at 20:21
  • The best practice recommendation to "avoid high impact changes during critical hours" [Source] is correct. It will always be the safest approach when there could be a wide range of metadata component types being deployed. Sep 29, 2022 at 20:57
  • 2
    @AdrianLarson Yes. I'm now a "We" when referring to Salesforce. "Product Manager Director for Apex at Salesforce" Sep 29, 2022 at 22:32
  • 2
    Congrats! That's awesome!
    – Adrian Larson
    Sep 30, 2022 at 12:13

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .