Sessions explorer and Browseable::Postgres
I noticed something intriguing on LLNG 2.0.3, using a Browseable::Postgres session store, and following the docs diligently:
CREATE UNLOGGED TABLE sessions (
id varchar(64) not null primary key,
a_session text,
_whatToTrace text,
_session_kind text,
_utime bigint,
"user" text,
ipAddr text
);
CREATE INDEX uid1 ON sessions USING BTREE (_whatToTrace);
CREATE INDEX s1 ON sessions (_session_kind);
CREATE INDEX u1 ON sessions (_utime);
CREATE INDEX ip1 ON sessions USING BTREE (ipAddr);
It seems that when displaying the session browser, things get very slow after >1000 sessions, and that shouldn't be the case because that is what Apache::Session::Browseable is for!
Turns out that the manager does this HTTP query:
GET /manager.fcgi/sessions/global?groupBy=substr(_whatToTrace,1)
which in turns calls searchOn with the following @fields
parameter:
$VAR1 = [
'_httpSessionType',
'ipAddr',
'_whatToTrace',
'_session_kind'
];
Well, well, looks like this _httpSessionType is nowhere to be found in the docs! And I certainly didn't declare it anywhere.
Because of the way Browseable::Postgres work, requesting a field that is not in the "Index" parameter will force LLNG to unserialize ALL sessions, (5000+) to fill the only parameter we care about: _whatToTrace
, whatAShame!
So I added _httpSessionType in the Index parameter and immediately ran into this other bug: https://github.com/LemonLDAPNG/Apache-Session-Browseable/issues/17
So, updating the documentation would be nice... but we need to warn the users that they need to update their Apache::Session::Browseable module as well, one that other bug is fixed.
PgJSON and PgHstore do not exhibit this problem because the fact that _httpSessionType does not have a DB-side index does not make much of an impact on performance. Postgres is much better at JSON than perl ;)
However I'm pretty sure that all Browseable::DBI backends will show similar performance issues on LLNG2 (maybe even 1.9?) with lots of sessions to display.