Badai Aqrandista wrote:
My mod_perl web app uses memcached to cache most of the (MySQL) database query results and as the session storage (Apache::Session::Memcached).

Would it be a problem for your application if you suddenly lost all of your session data? That could happen with memcached.

Yes, I'm aware of that. The problem is that the database structure is a reminiscent of the old version, which creates one database per client. It used to be only 40 clients and one web server. Now we have 300+ clients (=300+ databases) and 2 web servers. I always get 'Too many connections' error when I test the application with more than 100 concurrent request. Any other ideas?

As for how to find what is making your application slow, use Apache::DProf. That is the best way to find the bottleneck.

I have, and I have optimised it (with caches and indexes).

Now, This is the top 5 output of 'dprofpp tmon.out' before data is cached:

Exclusive Times
%Time ExclSec CumulS #Calls sec/call Csec/c  Name
14.4   4.189  9.431  16511   0.0003 0.0006  Cache::Memcached::_load_multi
12.5 3.639 3.639 693 0.0053 0.0053 Compress::Zlib::deflateStream::def
                                            late
8.94   2.589  3.018  46501   0.0001 0.0001  Params::Validate::_validate
7.68 2.225 4.025 17582 0.0001 0.0002 Cache::Memcached::__ANON__[/usr/sh are/perl5/Cache/Memcached.pm:667] 4.20 1.217 1.217 16511 0.0001 0.0001 Cache::Memcached::__ANON__[/usr/sh are/perl5/Cache/Memcached.pm:691]


... and this is after the cache is filled up ...

Exclusive Times
%Time ExclSec CumulS #Calls sec/call Csec/c  Name
22.5   3.752  6.911  15141   0.0002 0.0005  Cache::Memcached::_load_multi
15.6   2.602  2.939  38569   0.0001 0.0001  Params::Validate::_validate
9.56 1.595 2.242 15173 0.0001 0.0001 Cache::Memcached::__ANON__[/usr/sh are/perl5/Cache/Memcached.pm:667] 5.50 0.917 0.917 15141 0.0001 0.0001 Cache::Memcached::__ANON__[/usr/sh are/perl5/Cache/Memcached.pm:691]
4.05   0.676  0.676 102787   0.0000 0.0000  Class::Accessor::get

So, as you see, the subroutines that takes most of the time are realy needed (to speed up the code and to enforce code correctness). But I still need more speed (yes, I'm obsessed with speed :p... Hehe... It's just the old version -a bunch of cgi scripts put together- runs twice as fast as the new version -a modular OO structure-, and my boss wasn't pleased to hear that...)

Any ideas?

Anyway, thanks for your replies...

---
Badai Aqrandista
Cheepy (?)

_________________________________________________________________
Dating? Try Lavalife – get 7 days FREE! Sign up NOW. http://www.lavalife.com/clickthru/clickthru.act?id=ninemsn&context=an99&a=20233&locale=en_AU&_t=33473

Reply via email to