I've written a Windows service to use fluent NHibernate. The project
consists of 6 entities with associated mappings. When the service starts
it connects to the database using fluent. The code is the same as the
Fluent NHibernate console program sample.
Start up times are pretty slow ~10 seconds. So slow that starting up the
service sometimes fails due to timeout. I've tracked this down to the
session creation process, the method called CreateSessionFactory in the
sample program.
In order to make sure that it wasn't something I was doing I did the
same performance test using the Fluent NHibernate program itself.
Performance is about the same at 8093ms.
Anybody any ideas what I can do to speed things up? From what I can see,
it looks like it is the generation of the XML mapping files where the
majority of the time is being spent.
Regards,
Jack Hughes
--
You received this message because you are subscribed to the Google Groups "Fluent NHibernate" group.
To post to this group, send email to fluent-n...@googlegroups.com.
To unsubscribe from this group, send email to fluent-nhibern...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/fluent-nhibernate?hl=en.
Following this thread, I'm interested in knowing if anyone has any
further ideas about performance. My app is made in asp.net, and I'm
trying to follow the motto that "database connections are too
expensive", and each request that needs data opens a Session, then
maps objects, and so on.
I'm prematurely reaching the conclusion that this is not viable.
Creating XML mappings for each build defeats the elegant purpose of
FNH. I started to think in Java (app server) and service tiers, since
database connections are not really that expensive to me yet.
So, any thoughts?
Cheers,
Henrique
> --
> You received this message because you are subscribed to the Google Groups
> "Fluent NHibernate" group.
> To post to this group, send email to fluent-n...@googlegroups.com.
> To unsubscribe from this group, send email to
> fluent-nhibern...@googlegroups.com.
I think you're right, I will have to check how this is implemented.
Our group is formed mostly by Java developers, and ASP.NET is pretty
new to everyone. Thanks for the tip, will keep doing research on FNH.
Cheers,
Henrique Cabral
What about this approach:
Versus the Global.asax? Or the Burrow framework?
Cheers,
Henrique
Hello everyone,
What about this approach:
http://nhforge.org/blogs/nhibernate/archive/2010/07/11/nhibernate-bootstrapper-unitofwork-and-sessionperrequest.aspx
Versus the Global.asax? Or the Burrow framework?
Cheers,
Henrique
On Thu, Aug 12, 2010 at 7:26 PM, Henrique Cabral <hca...@gmail.com> wrote:
> James,
>
> I think you're right, I will have to check how this is implemented.
> Our group is formed mostly by Java developers, and ASP.NET is pretty
> new to everyone. Thanks for the tip, will keep doing research on FNH.
>
> Cheers,
> Henrique Cabral
>
Thanks for the inputs. I consider my FNH with AutoMap implementation
pretty clean and straight-forward, and I followed the docs well. For
my WCF services, the static calls had taken care of the handling of a
unique SessionFactory instace, but that was totally broken for ASP.NET
pages.
Right now I'm coding myself the IHttpModule to handle the
SessionPerRequest, will see how it goes. One of my problems is that I
have at least 4 databases, each has mapped entities, so you can
imagine that my Fluent.Configure() may get tricky.
Cheers,
Henrique Cabral
Could any of you guys share some real-life experience in production
servers with ASP.NET and NHibernate? I'm testing the solution now with
3 SessionFactory instances (I have 3 databases). If I open one session
per request, say we have a page with 30 elements, and say the web app
modestly has 10 simultaneous users, we may reach up to 300 opened
sessions at any given moment. If you have an insight about this and
would like to share, I would appreciate it. Or maybe point at some
papers or blog entries.
Cheers,
Henrique Cabral
Indeed, but from what I could see during my debug session, referring
to a CSS file is a request, opening an image is another, and so on.
Hence my fictional number of 30 sessions. The methods BeginRequest and
EndRequest are invoked several times.
Cheers,
Henrique
James,
Indeed, but from what I could see during my debug session, referring
to a CSS file is a request, opening an image is another, and so on.
Hence my fictional number of 30 sessions. The methods BeginRequest and
EndRequest are invoked several times.
Cheers,
Henrique
The only requests that should open sessions are ones that actually request your aspx pages (or controller actions if you're doing mvc).
In a typical web app you'll be looking at opening one session for loading a page; the only exception to that rule is if you're making ajax requests from your page too, in which case each of those would be a new request and therefore a new session.
James,
Indeed, but from what I could see during my debug session, referring
to a CSS file is a request, opening an image is another, and so on.
Hence my fictional number of 30 sessions. The methods BeginRequest and
EndRequest are invoked several times.
Cheers,
Henrique
Thank you all for the help, this is a great community!
Cheers,
Henrique Cabral
On Fri, Aug 13, 2010 at 3:00 PM, Jason Dentler <jasond...@gmail.com> wrote:
> Premature optimization. Don't worry about it right now. Sessions are VERY
> lightweight. Just be sure to dispose of them properly.
>
> On Fri, Aug 13, 2010 at 1:54 PM, Henrique Cabral <hca...@gmail.com> wrote:
>>
>> James,
>>
>> Indeed, but from what I could see during my debug session, referring
>> to a CSS file is a request, opening an image is another, and so on.
>> Hence my fictional number of 30 sessions. The methods BeginRequest and
>> EndRequest are invoked several times.
>>
>> Cheers,
>> Henrique
>>
>> On Fri, Aug 13, 2010 at 2:17 PM, James Gregory <jagreg...@gmail.com>
My point exactly, we have some time to study these solutions and fine
tune the application. Even with requests to static objects, like I
mentioned before, there's a significative improvement. I agree with
you, it's crazy, specially if the user base grows. I'm searching on
how to filter the requests.
Nick, and you're right, I also monitored the database connections, I
know I'm dealing with NHiB sessions, not database connections.
Cheers,
Henrique