Having spent a considerable time looking at all the usual issues, caching, or lack of, persistent variables, slow running pages, drivers etc, and tweaking code that looked like it might be the cause, I was coming up empty. Then after dumping out the entire session scope for the application, I discovered that the clients shopping cart CFC was persisting itself inside every session, and with over 1200 sessions in use, this was just eating up more and more memory.
This handy bit of code, is what will dump out all your sessions. Thanks to Alex @ pixl8.co.uk for his help and putting me onto these handy java methods.
sessiontrackerObj= createObject("java","coldfusion.runtime.SessionTracker");
activesessions = sessiontrackerObj.getSessionCollection(application.applicationname);
nosessions=ListLen(structkeyList(activeSessions));
</cfscript>
<cfoutput>
<h3>Total Sessions : #nosessions#</h3>
</cfoutput>
<cfdump var="#activesessions#">
So the lesson to be learnt here is, watch out what you put in your sessions or other persisted scopes. In this example you only needed a single instance of a CFC to be invoked, and it should be used to populate an external structure in the session. Another example of why using the THIS scope in a CFC is bad.
Here is a nice blog on other runtime methods you can use to access and manipulate session data. http://jehiah.com/archive/extended-operations-on-coldfusion-sessions



There are no comments for this entry.
[Add Comment]