Andrew DevSterMan

Greenhorn
+ Follow
since Nov 26, 2003
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Andrew DevSterMan

Hi Merrill,

I can have up to 350 connections open. I presume these can be used concurrently. (DBA is away).

I am using the connection pool as a datastore configured in tomcat. It works beautifully for short snappy queries, and return them to the pool - indeed a standard page can make three of 4 queries, but holding down F5 on these the pool only needs the 5 or so connections, and then manages to recycle them. Its the more heavyweight queries that I have problems with.

I've stuck a fast a dirty cache (to prevent the user requesting the same data over and over from the database, which works).

I may try other application servers. You might be right. I understand that Tomcat is a reference implmentation.

Any recommendations on an enterprise server?. Ideally open source / free.

Many thanks

Andrew
14 years ago
Hi,

Thanks for your help.

You are right about error logging and the like, but deadlines, deadlines, deadlines.

I am now sure that the requests are queued up in one method call in my action class. I have worked around the problem by caching the data in the session, so that a single user pressing down F5 doesn't disable the site

I was hoping for some breakthough which meant a faster request would return first, even if dispatched after a slower one.

I have no Syncronization (added that is).

This isn't an error / exception, it is behavioural - faster requests for the same thing are queued behind slower requests.

Cheers
Andrew
[ April 11, 2006: Message edited by: Andrew DevSterMan ]
14 years ago
This is effectively what I have. The query is long a built on the fly.

Midway through, I also call another DAO that uses its own connection to do something.

package com.x.site.vacancy;

import java.sql.*;
import java.util.*;
import javax.sql.*;

import com.x.site.DAO.*;
import com.x.site.constants.*;
import com.x.site.logo.*;
import com.x.sql.*;
import com.x.utils.*;

public class OracleVacancyDAO
implements VacancyDAO {

public OracleVacancyDAO() {
System.out.println( "--- CREATION : a OracleVacancyDAO() " + this.toString() );
}

public boolean addVacancy() throws SQLException {

DataSource ds = null;
ds = OracleDAOFactory.getDataSource();
boolean returnBoolean = false;
Connection con = null;
con = ds.getConnection();

ResultSet rs = con.execute("SEELCT * FROM ....");
for ()
{
// Make a bean
}


con.close();

return returnBoolean;
}
[ April 11, 2006: Message edited by: Andrew DevSterMan ]
14 years ago
I'm all hung up ...

I seem to have hit a problem with my struts application.

I am using -

1. Apache's Database Connection Pool.
2. The DAO pattern.
3. Tiles.
4. Tomact 5.0x

I have a problem where the Action classes, for say listing for a Client. This listing also searches for Jobs currently available for the client.

I have an action class that gets a client, and then gets the jobs for the client. All is well and good with this - it works beautifully, its succinct and easily maintained.

My problem comes with scalability. If I submit the http://localhost:8080/getClient.do?clientId=10 url from 2 or more browsers, they will all queue until the first comes back. It feels like the requests are queued up in the action.

Now I've looked around a lot, and have found very little by way of suggestions on how to fix this, or even acknowleding it.

I feel I am missing something here. I understand the action is a single instance, but should the threads not be running simulatenously? My DAO contains a reference to a simple datasource, which will freely give up connections to the DAOs, the processing doesn't seem to continue until the connection that came out first is returned to the pool.

Other Actions using the connection pool continue to function fine irrespective of the ClientAction being 'busy'.

Any directions would be gladly received.

I'm a bit desperate to fix this. I've seen something about ThreadLocal and filters, and I've also considered creating multiple copies of the action and giving them different names, but this seems very wrong indeed.

Cheers

Andrew
14 years ago
Hi there.

I've been running up a new website, using Struts, the DAO pattern and Apaches DBCP (database connection pool).

Somewhere in here I have an action to do a search against the database. This takes about 2 seconds to return.

This opens up say 40 connections in the pool.

If I lean on F5 submitting request after request, and open the same page in a different browser, I don't get a results until my connection pool settles down to 0 again.

Is this because

- the request is the last one, and gets serviced last.
- the DB pool is doing something funny.
- I've totally missed something and everyone has to queue when accessing the database.

I'm worried. All my code if pretty clean, but I don't know how to test this to see if I can get any concurrency. I'm using tomcat 5.

Other pages continue to respond beatufiully.

Cheers

Andrew
14 years ago
I've got a servlet to cache my data from several databases located all over the world. Some have fast lines, some slow. I initially had all of the data cached on start-up by setting the servlet to run in web.xml, but now some of the offices that have been added are taking 10 minutes plus to connect to.
My question is, how do I automate the caching of my data after the appilcation itself has started, so that the application doesn't take forvever to come online, but that the data can be populated as the databases return their queries?
I'd really appreciate any example code.
Many thanks
Andrew
16 years ago