<code>class Test { public static function test1(){} public static function test2(){} ... } </code>
When executing php code, static methods are scanned, regardless of whether they are included., they are too inefficient and should not be used.
When I include 'Test.php'
, will it scan the class and load the static method into the memory? At this time, all methods should be loaded into memory.
If 2
is not true, should it be loaded into the memory when calling the method Test::test1();
? If loaded at this time, should only the current method be loaded, or all static methods of the current class?
Here is a master who talked about Nginx and Php-fpm processes and threads: https://segmentfault.com/q/10...
If this is the case, one Php-fpm process serves one client, but if the concurrency is too high, won't there be many processes? In terms of process communication, requests from different clients belong to different processes and should not affect each other. There should be a cache of static methods in the memory occupied by the process. However, if a client has multiple requests, read the article. It is a blocking single-thread model, so each request should wait until the last request is completed before starting execution. Will the cache of the static method be cleared at this time, or should it continue to be saved? If cleared, static methods should not be shared.