Are static methods good for scalability?

后端 未结 8 537
故里飘歌
故里飘歌 2021-02-04 19:03

Does static methods and class are good for scalability ? I think so static class/method improves scalability of application and instance methods doesn\'t scales much. So is it g

8条回答
  •  孤街浪徒
    2021-02-04 19:30

    No static methods don't intrinsically scale better. Infact the programming style (imperative or object oriented) does not really make any difference to scaling whatsoever. There are two major aspects of scaling and what to do to improve scale depends on which we mean:

    1 Scaling by number of requests a second handled

    This type of scaling is normally about adding more computers to a cluster to improve overall throughput of the system. Increasing scaling is often about initially reducing the amount of shared resources used through the use of caches and then later making the data access split into shards.

    2 Data Scaling

    This is when the system gets more and more data over time and operations that access the data (search, filtering etc) get slower as the algorithms are more complex than O(1). In this case the normal strategy is to increase the number of read and write points and use parallel algorithms such as Map/Reduce.

    But neither of these aspects has anything to do with whether you use static methods or not, just whether multiple requests work on large sets of data or single sources of data.

提交回复
热议问题