session - How to measure HttpSession size accurately and effectively -
is there easy, effective , accurate way measure session size in servlet based application? preferably measuring method should application server/container independent.
tried measuring session size lambda probe on tomcat 7, seemed me quiet inaccurate, slow , buggy. think there should easy straightforward way, because every decent java ee developer cares session size.
i want stress test application , measure session bloat.
this how calculate size of session in application itself:
totalsize = 0; totalserializable = 0; totalnumber = 0; httpsession session = getsession(); enumeration<string> attrs = session.getattributenames(); while (attrs.hasmoreelements()) { string attr = attrs.nextelement(); sessionobject sobj = new sessionobject(attr, session.getattribute(attr)); sessionattributes.add(sobj); if (sobj.isserializable()) { totalsize += sobj.getsize(); totalserializable++; } totalnumber++; }
Comments
Post a Comment