I use the "Open Session in View" pattern for production sites. Works
great. I did some serious stress testing with and without the pattern.
The results did not show a performance penalty when using the pattern,
and neither did I get deadlocks etc. I guess there could be a
performance penalty if you have really heavy processing going on when
handling the request (more like seconds of work).

FYI, the test with the servlet filter ran for 30 hours with 50 simulated
users/ threads full-on (no breaks) and with a database connectionpool of
20 connections on 5 different pages that had 3-6 different hibernate
actions per page, including inserts and updates. Unfortunately I did not
keep the exact results. But a quick test with a page that does 5
diferent queries (read only, no caching) on my laptop (P3 1.3Ghz, WinXP,
JDK1.4.2, Jetty and MySQL 4.0...) here shows an average of 90 requests
per second without any real dips.

Hope that gives you confidence ;)

Eelco

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Juozas
Baliuka
Sent: woensdag 6 augustus 2003 17:50
To: Joseph Fifield; [EMAIL PROTECTED]
Subject: Re: [Hibernate] Unit Testing With ThreadLocal Sessions

> I don't close the session at all in any of my business logic methods.
> In deployment, a servlet filter _always_ closes the session at the end
> of the

 It looks like not the good way for performance. As I understand
"doFilter()" returns after output is sent and connection is open/locked
too long ( waits for "out.flush()" ). I have never used Fillter to close
connection in production (I close it in "controler" or "dispatcher"),
but this way is very simple, doe's it performs for you ?

> request. For unit testing, I have a base test case class that does the
same
> thing in the tearDown() method. That way, each test case can execute
> in
the
> same manner as the app running in deployment (i.e. each test case is
> like
a
> separate "request"). The result is each test case executes using the
> same session, and they don't need to worry about closing it at the
> end.
>
> Hope this helps...
>
> Joe



-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including
Data Reports, E-commerce, Portals, and Forums are available now.
Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01
_______________________________________________
hibernate-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/hibernate-devel

Reply via email to