Hi!
I'm relatively new to Tuscany and the JEE world, so I have a few
questions on to correctly provide a service in a production environment.
What I'm generally want to do is to provide the output of certain
computational simulations stored in a database to a php-based web
frontend, the output of my service is basically a (rather
sophisticated) function of what the php frontend does to the database.
I made a small dummy service in java along the sample shopping cart
service included with the examples and connected it to php by jsonrpc.
So far, it works great and provides exactly what I had in mind.
However, I'm wondering if I could improve performance by using
database connection pooling and what happens when the service is
invoked. As it looks to me, when the service is invoked, a new
instance of my ..Impl class is created, a database connection is
created and afterwards destroyed together with the ..Impl instance. Is
that correct? What I'd prefer is just one instance for the whole time
and one thread per user that can read all my private variables that
are initialized when the service is started and that all the database
connections are recycled. I'm not really sure if this is possible with
the Tuscany distribution (currently using Tuscany 1.5.1 with Jetty,
the current eclipse version doesn't install the Tuscany 1.6 plugin) or
whether I need a JEE application server to do this (i.e. Geronimo).
If I do, how can I configure the eclipse Tuscany plugin, so that it
runs the Geronimo version instead of the non-geronmio version that
comes when the plugin is installed?
What would be the correct way of to provide connection pooling? As
I've read somewhere, both Tomcat and Jetty provide a way to do this,
then there's apache commons DBCP, and the javax.sql DataSource. I
guess, I would prefer the javax.sql DataSource as it appears to me to
provide the cleanest approach, extensibility and allows to configure
details about the database driver outside of the code by JNDI, but I
read that looking up a JNDI context can be slow and should be cached
(i.e. I'd require that there's just one instance with worker threads)
and I have no idea on where to configure that database resource so
that my java service finds it.
I hope these questions are not too much newbie, I'd be really happy if
you could give me some hints on how to configure my enviroment and if
you might have a few pointers in which way to go.
Thanks a lot,
Stefan
- Java service with db connection pooling S . Schadwinkel
-