Moved to instances, closed sessions on hibernate, added comments for …#1
Moved to instances, closed sessions on hibernate, added comments for …#1cassman42 wants to merge 1 commit intovitorbmiranda:masterfrom
Conversation
|
Hey @cassman42 thanks a lot for the inputs. Indeed there were improvements to be done as you mentioned but I didn't touch this much after the blog post. I'll read your changes carefully - no guarantee it will be quick as I've changed my machine setup recently. The reason for instantiating the Service/Repository was just to avoid using statics and simulate something closer to a real scenario (with objects lifecycle). But this is such a simple test that maybe it doesn't matter really. Apache Benchmark looks interesting, never looked at it, so thanks for the reference. |
|
To be honest when I perf tested your original code I immediately hit issues with the DB connections running out. Can you try your code with ab just to see? |
|
Ok got it, will give it a try. |
Hi,
Saw this on your blog and I was surprised that you were instantiating a new TaskService, repository etc on each hit.
I've removed the static's.
The TaskService is instantiated once and given a Repository with the hibernate session.
I've added try with resources to handle the Hibernate session.
Ideally the queries should be named ones, but hey ho.
Please try it with your perf tests and see if it makes any differences - i'd be interested.