[horde] performance when some components are not on local network
Aleksandar Milivojevic
alex at milivojevic.org
Thu May 4 11:43:40 PDT 2006
Hi,
I'm having a problem with performance when some of the components
(either IMAP server, or SQL database, or both) are not all on the same
local network as web server where Horde is installed, but rahter on
the other end of T1 based WAN.
For example, if web, IMAP and SQL servers are all on the local
network, things work fast, almost instantly.
However, if IMAP server is not on the same network as web server,
things slow down drastically. Simmilary for SQL server on different
network. Takes some 20 seconds just for a user to log in. So I took
a look what is going on the network, why it takes that much time to
simply log the user in.
I did tcpdump of traffic from the moment user clicks on "login"
button, till the first page is fully loaded. The dump contains some
870KB of traffic between Horde, SQL and IMAP servers!!! Just to
generate a single page. Large portions seem to be either duplicate
data, or data that gets discarded/overwritten several times in a row.
Some examples. The horde_sessionhandler table gets constantly updated
again and again and again. Wouldn't it be enough if it was updated
only once, after the page is completely loaded? Strangely, even with
this constant updates, if I switch from SQL sessions to standard PHP
sessions, time it takes to log the user in doesn't reduce noticably!?
It could be that latency plays bigger problem than bandwith itself
(since even in case of local PHP sessions, there's still relatively
large number of queries going to SQL server).
The user's prefs seems to be loaded from database multiple times for
single page load too. These are not generating a lot of traffic, but
you do it over and over again on network that has some latency, and it
is definetely noticable.
Looking at the IMAP traffic, there's lot of not needed work there too.
There's not much traffic going in terms of data transferred. But if
you put the latency of WAN into calculation, it considerably slows
down things.
Again some examples. I can see IMP issuing some LIST commands to get
list of folders. It does LIST "" INBOX.%, and than repeats for other
namespaces. Than it does a new LIST for each returned folder.
Hmmm... Why doesn't it simply LIST "" INBOX.* and get all it needs in
one command? Or even LIST "" * and get really everything in one go?
It also does bunch of LSUB commands, that basically don't reveal any
new information that wasn't already present in output of LIST (or at
least I'm failing to see it).
Anyhow, just wanted to point to some places where there might be a
place to optimize things a bit (we are not all running gigabit
networks, and even with those, the latency can be a killer). Not to
mention generating almost a megabyte of network traffic just to
present a user with one simple page... Now imagine 100 users doing it
in parallel...
--
See Ya' later, alligator!
http://www.8-P.ca/
More information about the horde
mailing list