Multiple statically stored values ​​create scaling problems

This article mentions the following at the end: "With a lot of statically stored values, your application won't scale well."

I thought that initializing a variable only once and using it across instances is actually efficient as it saves memory reallocation every time the class is initialized. This is contrary to the above statement. I understand that load times may increase as the JVM has to initialize this object from the beginning, but it will only be done once.

Can anyone please explain what exactly this means or what exactly does "a lot" mean in the statement?

+3


source to share


1 answer


This is for scaling developers, static variables are akin to the global value pattern , which can lead to hard, unstable code and difficult to fake / unit test.



When it comes to CPU performance, static fields and methods are very fast because they do not protect the OO overhead and some performance / low latency professionals use them for this very reason.

+2


source







All Articles