[ome-devel] Request latency
Ilya Goldberg
igg at nih.gov
Thu Jan 19 21:43:06 GMT 2006
I've recently committed some changes to the way sessions are
allocated during requests to the OME back-end. The initial purpose
was to reduce the number of database handles that each request
generates. It used to be up to 4 (briefly) per request, with two
handles left open (cached) per apache child. Now its at most one
handle per child, and they're opened one at a time (unless extra
handles are requested during processing). This should make running
out of DB handles extremely rare (if ever). Another side-effect was
to re-cycle sessions if an incoming SessionKey (from the browser
cookie, say) matches the singleton OME::Session's SessionKey.
All code works the same way since everything uses the SessionManager
to get OME Sessions.
That's just intro - not very interesting.
I was curious what the performance benefit to all this was, so I
wrote a little client-side script (using Ajax, of course) to find out.
This little script issues 25 sequential requests using the
XMLHttpRequest call to a back-end object I cooked up called
OME::Web::Ping. This object authenticates the client (i.e. gets an
OME session), then returns "Hi!" as text/plain. This is meant to
represent the absolute minimum round-trip time for a client request.
Curiously, previously our request latency was over 100ms. Now, the
request latency is 15ms on average (This is on a 1GHz G4 laptop using
localhost). Different browser versions have quite different
performance, so its an interesting test. 15ms was with Safari 2.0.3
and FF 1.5. FF 1.0.4 got about 45ms average. What do you get?
This benefits the web UI as well as XMLRPC (i.e. OME-Java, Shoola and
friends) because they all use the SessionKey to re-connect to a
session, and they all eventually go through the SessionManager.
Incidentally, if you're interested in Ajax, the tester, etc, here's
where everything is:
The tester browser page is in src/html/Tests/ajaxTest.html (you
should be able to go to http://localhost/html/Tests/ajaxTest.html
after cvs update)
The cross-browser Ajax library I borrowed is in src/JavaScript/
sarissa.js
The server-side object that responds to the requests is in src/perl2/
OME/Web/Ping.pm
Enjoy!
Ilya
More information about the ome-devel
mailing list