Re: [PHP] application-wide shared data/object

2005-07-28 Thread Rasmus Lerdorf
This is the sort of thing we call a scalability killer. Loading everything into memory on one machine and then adding locks presumably for writing to this memory means you are limiting any sort of horizontal scalability and you are slowing down the one machine you do have with lock contention.

Re: [PHP] application-wide shared data/object

2005-07-28 Thread Aiguo Fei
Thanks your insightful comments. Clearly scalability is a concern for large scale applications. One has to be discreet with it if such a facility is available. For the dictionary example, I feel it definitely can use such a facility and DB approach is much slower; and scalability/load balancing

Re: [PHP] application-wide shared data/object

2005-07-28 Thread Aiguo Fei
In the example I gave, I mean the whole thing is loaded once, then every session can use it. Basically it is like a cache, only it is available cross sessions. Clearly one can use DB to store data to do that, however, (1)there are things that are not suitable to store in a DB; (2)DB is

Re: [PHP] application-wide shared data/object

2005-07-28 Thread Justin Mazzi
http://eaccelerator.net/HomeUk Will keep scripts cached in memory etc. Maybe this is along the lines of what you are looking for. Aiguo Fei wrote: Thanks your insightful comments. Clearly scalability is a concern for large scale applications. One has to be discreet with it if such a facility

Re: [PHP] application-wide shared data/object

2005-07-28 Thread Rasmus Lerdorf
Aiguo Fei wrote: Thanks your insightful comments. Clearly scalability is a concern for large scale applications. One has to be discreet with it if such a facility is available. For the dictionary example, I feel it definitely can use such a facility and DB approach is much slower; and

Re: [PHP] application-wide shared data/object

2005-07-28 Thread Evert | Rooftop
Rasmus Lerdorf wrote: Not much documentation is needed: if(!$dict = apc_fetch('dict')) { $dict = function_that_returns_a_dictionary_array_or_object(); apc_store('dict',$dict); } That's all. [snip] -Rasmus Wow, I should have tried harder to make it work.. thnx ! Evert -- PHP

[PHP] application-wide shared data/object

2005-07-27 Thread Aiguo Fei
In ASP.Net there is the concept of application which is a virtual directory on a Web server. An application can have application-wide shared data/objects, which can be accessed by any script of that application (i.e., scripts under the virtual directory). I have gone through several PHP books,

Re: [PHP] application-wide shared data/object

2005-07-27 Thread Joe Wollard
Aiguo, To achieve good performance, I want to load the whole dictionary into memory when the application starts (e.g., when the web server starts... I'm not sure how ASP works, but in PHP you can't load something into memory when the web server starts and keep it there. PHP 'compiles'