开发者

Is it possible to have a persistent PHP session for faster delivery of webpages?

开发者 https://www.devze.com 2023-03-28 20:02 出处:网络
Well, to be specific, I\'m running my own content management system running on Linux Apache2 MySQL PHP server. The system is comparable to Linux kernel w/ modules.

Well, to be specific, I'm running my own content management system running on Linux Apache2 MySQL PHP server. The system is comparable to Linux kernel w/ modules.

--(request start)--

The system launches his "init" script that takes care of dependency-based module loading (only minimum modules are loaded, in proper order, so it "just works", but nothing else (disabled/unused modules are not loaded)).

Once the system is ready, request processing comes in - all the data gets loaded, parsed, processed, buffered, chewed and so on, until we have a complete (x)HTML page.

--(request end)--

Once the request is processed, the data are passed to browser and the system is killed. All this happens in a very short time, but the most cpu-intensive is th开发者_运维百科e beginning part (preparating system for use).


I have a few options:

  1. Let system be in a way it's now (and risk performance issues after it's deployed for REAL usage (approx. 100-500 requests/s per system))
  2. Do some kind of preloading (preparing the system manually and not let anything magic happen then)
  3. Find a way to keep the system in ready-for-use state (all modules loaded, classes initialized, ready MySQL link, etc.)

Question is:

  • Is there a way to accomplish point 3? (point 2 is what I want the least)
  • If it's possible, how?

Thanks for any advices that'll point me right way!


Probably what you need is PHP APC, eAccelerator or some other extension that parses your code and keeps it as byte-code in the memory, which for CPU hungry situations can help your performance a LOT. It seems that you have the knowledge to setup such extension, I would recommend you the "APC" being the most used and tested one out there:

http://en.wikipedia.org/wiki/List_of_PHP_accelerators

Edit: For MySQL I would go with using "persistent connection" which might help as well.


You may Want to compile your Php into a c++ Or Java and gain performance by sacrifice a little Bit go check the wikipedia for more info's HipHop

0

精彩评论

暂无评论...
验证码 换一张
取 消