Win a copy of OCP Oracle Certified Professional Java SE 11 Developer Practice Tests this week in the OCP forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Ron McLeod
  • Tim Cooke
Sheriffs:
  • Devaka Cooray
  • paul wheaton
  • Mark Herschberg
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Frits Walraven
  • Jj Roberts
Bartenders:
  • Carey Brown
  • salvin francis
  • Piet Souris

Consuming database connections

 
Ranch Hand
Posts: 17424
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm using 2.1.7, but I doubt things are much different in 2.1.8.

What I noticed is that each view action keeps a db connection open even when it's not needed.
The context opens a db connection when first db request is made (to get/set some data) and remains open (not released) until the context is finished.

It's not a big deal with pageviews or post writes/edits.

But with large attachments, it consumers all available db connections and takes the whole application context down.

downloadAttach might take a long time to complete. Now imagine 50 users on dial-up connections downloading 10MB attachment.

That's 50 database connections used all at once.

Is there a way (some quick hack) to make it release the db connections right after the "am.isPhysicalDownloadMode" call within downloadAttach()?

I don't care that the download counter would be off when people abort downloads. I would rather just commit the transaction and after that pipe the data to the client.

Is it possible to do that without writing almost redundant methods for dao,context classes to be used with downloadAttach?

My box was down 3 times during the last month, all because of 50 or so people trying to download the same large attachment at the same time.


[originally posted on jforum.net by bcc]
 
Migrated From Jforum.net
Ranch Hand
Posts: 17424
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Here is a hack for anyone in a similar situation.
I tried to change as little as I can.

The line numbers might not match with 2.1.7 vanilla because I made some other changes.
So if a patch run fails, then try editing manually or match the line numbers in the diff below to your real line numbers.


[originally posted on jforum.net by bcc]
 
I got this tall by not having enough crisco in my diet as a kid. This ad looks like it had plenty of shortening:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic