Krishna Srinivasan
krishna at ironport.com
Tue Jun 8 19:42:32 EDT 2004
Greetings. I have been running modpython on FreeBSD and am using Sessions and after 5 days, I see that apache process have bloated up so much. Here is the result of a 'ps'. myprompt> ps -auxwww | grep httpd root 91669 0.0 0.3 4676 1404 ?? Ss Fri10AM 0:19.63 /usr/local/apache2/bin/httpd -k start nobody 91670 0.0 0.0 160592 0 ?? I Fri10AM 0:45.10 /usr/local/apache2/bin/httpd -k start nobody 91671 0.0 0.0 119660 0 ?? I Fri10AM 0:31.95 /usr/local/apache2/bin/httpd -k start nobody 91672 0.0 0.0 150408 0 ?? I Fri10AM 0:44.50 /usr/local/apache2/bin/httpd -k start nobody 91673 0.0 0.0 142168 0 ?? I Fri10AM 0:41.49 /usr/local/apache2/bin/httpd -k start nobody 91674 0.0 0.0 168092 0 ?? I Fri10AM 0:51.81 /usr/local/apache2/bin/httpd -k start nobody 91675 0.0 23.9 148500 124096 ?? I Fri10AM 0:45.54 /usr/local/apache2/bin/httpd -k start nobody 53978 0.0 0.0 137308 0 ?? I Fri12PM 0:33.51 /usr/local/apache2/bin/httpd -k start nobody 71837 0.0 0.0 148896 0 ?? I Fri01PM 0:44.87 /usr/local/apache2/bin/httpd -k start nobody 73291 0.0 0.0 144080 0 ?? I Fri01PM 0:40.64 /usr/local/apache2/bin/httpd -k start myprompt> System - FreeBSD 4.9 - Apache 2.0.48 - Python 2.2.3 - ModPy 3.1.3 [Using ModPy Publisher handler] When I start apache, it's about 4.5 Megs and after the first request comes in, it goes to 15-20 Megs and stays between 15-25 for a while. This is per process. Why does it go up by so much ??? Could anyone please please explain what's going on ? Many thanks in advance, Krishna. PS - I have also attached my previous emails where I am seeing my /tmp/mp_sess.dbm just go up ! I am doubting if that has anything to do with apache itself becoming so huge ! ---------- Forwarded message ---------- Date: Thu, 3 Jun 2004 19:17:45 -0700 (PDT) From: Krishna Srinivasan <krishna at ironport.com> To: "Gregory (Grisha) Trubetskoy" <grisha at modpython.org> Cc: Modpython <Mod_python at modpython.org> Subject: Re: [mod_python] Session Cleanups - Still a mystery Greetings. When I said "cleanup", I meant session-deletion when I explicitly call "sess.invalidate()". (I apologize for the confusion). I wrote some print(to file) statements into the Session.py file and tested my app. Just one user(me), doing one set of transactions - one login, few actions, logout. I find that when I call "sess.invalidate()" the code goes all the way to "do_delete()" and then fails in the try-clause (due to KeyError). 'self._sid' is not there in the dbm. Why is this failing ? I see that the code just does a 'pass' on that (key)error. And I put in a print to show my session-id when it's new - however, during one session, I get back two prints - so there are two sessions. Could it be because of a request to a different server for, say, an image ?? [Just a guess] Here is one more question, I cannot read the values of the dict from a python cli. prompt> cd /tmp prompt> python >>> import bsddb >>> a = bsddb.hashopen("mp_sess.dbm", "r") >>> a.keys() ['55d6151503a8bb61251ce6027fbc065dd', 'afea89bd5eb5d836ec4939615dffa8b22'] >>> a['55d6151503a8bb61251ce6027fbc065dd'] Traceback (most recent call last): File "<stdin>", line 1, in ? KeyError: 55d6151503a8bb61251ce6027fbc065dd >>> However, I could say something like, >>> a.first() And I get back a pickled-object as str. [I could keep doing a.next() too and it works] Am I doing something wrong here ?? > Session cleanups should happen randomly Thanks, I finally did RTFM and figured that out. (and how to set it to a different number if I need to via Session.CLEANUP_CHANCE) > How big is the dmb getting that you are concerned with space? Like I said, my problem is session-deletion is not getting done properly. And since I store large-objects in the session-dictionary, it gets large. And that's how I noticed. Looking forward to helpful suggestions/hints, Thanks, Krishna. On Thu, 3 Jun 2004, Gregory (Grisha) Trubetskoy wrote: > Date: Thu, 3 Jun 2004 20:35:32 -0400 (EDT) > From: "Gregory (Grisha) Trubetskoy" <grisha at modpython.org> > To: Krishna Srinivasan <krishna at ironport.com> > Cc: Modpython <Mod_python at modpython.org> > Subject: Re: [mod_python] Session Cleanups - Still a mystery > > > Session cleanups should happen randomly with about 1 in 1000 chance (1 out > of 1000 session requests will trigger a cleanup). During a cleanup, all > expired sessions should get deleted from the dmb. > > How big is the dmb getting that you are concerned with space? > > Grisha > > On Thu, 3 Jun 2004, Krishna Srinivasan wrote: > > > > > Greetings. > > > > Can someone please explain how exactly sessions are cleaned up ? > > I am seeing a constant increase in the /tmp/mp_sess.dbm though > > I believe I am doing a 'delete' (and cleanup). > > > > I had posted this question some days back, here : > > http://modpython.org/pipermail/mod_python/2004-May/015706.html > > > > For each session, whenever a user does some action (which internally > > involves creating objects and storing them in the session dictionary), > > I do a "req.sess.save". > > [Where req.sess = Session.Session()] > > > > And then when they do a 'logout' - I do this : > > req.sess.delete() > > > > However, the size of mp_sess.dbm in /tmp is on the rise > > always. Can someone please tell me what else I should be doing ? > > > > I store everything in a simple dictionary. > > req.sess["mydict"] = <mydictionary> > > The 'mydictionary' object keeps expanding based on user-actions. > > I even do a 'del' to remove objects from this 'mydictionary' > > object to keep the space down. > > > > System - FreeBSD 4.7 - Apache 2.0.48 - Python 2.2.3 - ModPy 3.1.3 > > > > Please let me know how to fix this. > > > > Thanks, > > Krishna. > > > > _______________________________________________ > > Mod_python mailing list > > Mod_python at modpython.org > > http://mailman.modpython.org/mailman/listinfo/mod_python > > >
|