Re: Extra (persistant) tier

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,

on 06/20/2005 03:44 PM Evert | Rooftop said the following:
Hi,

I'm writing a big web application, and trying really hard to seperate business logic and presentation, which been no problem up to now. Because I abstracted the business logic so much the framework became heavier, sometimes a simple action can take up to 2 mb memory and several extra milliseconds.

I know this doesn't sound much and I'm applying all kinds of technique's to reduce resource-usage and increase speed. The thing is, I feel like I need to split the business tier up in 2 tiers, one of them being my persisitant object manager. The main reason is because every script that is executed must do some initialization and database calls, and I think I could reduce this by making a persistant tier, but there doesn't seem a good way to do this using php except when I would use sockets.

Shared memory doesn't really seem like an option, because I would still need to include all the classes to manage it, and when I use shared memory, the memory would still be copied into the php memory + having a central manager seems like a good idea.

I know I'm pretty vague in my requirements, but I think it should be enough to explain what kind of solution I´m looking for, because this seems like a big advantage of java over php, or am I mistaken?
If you have any ideas, let me know :)

What takes more time and CPU is not quite loading objects in memory, but rather executing queries to a database.

What you need is not exactly called an object persistence tier, but rather object caching.

I use this generic data caching class, for instance to cache logged user profile and session data objects so I do not have to query that same information on every request.

http://www.phpclasses.org/filecache

It saves a lot of time and CPU because I use it in a site that keeps over 22,000 sessions often for many weeks.

If you have a content site, you can achieve better efficience than this by actually caching the content that is not changed frequently, rather than caching the objects or the database query results that are used to generate that content.

For instance, if you have pages that show articles, you can cache the HTML of parts or all of such pages and so you avoid the overhead of generating those HTML excerpts every time you need to serve them.

I use the same class above in a site that keeps 550MB of cached content in files. It works wonders not only because it is much faster but because it allows many concurrent users to read or change the content at the same time using maximum efficiency.

BTW, do not bother with shared memory because it is always limited and the cache support of your file system often does a better job of keeping in memory what is frequently accessed.


--

Regards,
Manuel Lemos

PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/

PHP Reviews - Reviews of PHP books and other products
http://www.phpclasses.org/reviews/

Metastorage - Data object relational mapping layer generator
http://www.meta-language.net/metastorage.html

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux