tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Schultz <ch...@christopherschultz.net>
Subject Re: Tomcat calling into itself
Date Wed, 06 Apr 2011 18:48:17 GMT
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Michael,

On 4/5/2011 2:56 AM, Michael McCutcheon wrote:
> I have heard that it is not recommended to run the webapp on the same
> tomcat instance as Solr, due to potential threading issues of tomcat
> calling into itself.

If your webapp and Solr will be hosted by the same instance of Tomcat,
you will need to make sure that N incoming requests to your webapp don't
establish N loopback requests to Solr and essentially use 2*N request
processors, thereby choking your actual remote users.

You can mitigate this in one of several ways:

1. Run a second, localhost-only Connector on a different port: use that
   port for your loopback connections and make sure you have enough
   request processors on that Connector. I think this is probably
   the easiest to do.

2. Run multiple Tomcat instances. This is the second-easiest strategy.

3. Run multiple physical/virtual servers. This is the same as #2 except
   that you aren't using "localhost"... you are using a different host.

4. Use a Java-based interface to Solr instead of the HTTP interface. I'm
   no Solr expert, but I know that Solr is essentially distributed
   Lucene with web services exposed... does Solr even have a Java-based
   interface? This may be your best-performing option if it's possible.

> Or is there a way to configure tomcat so that the webapp and solr can
> run in the same tomcat instance, reliably and without threading or
> performance issues?

Tomcat shouldn't have any threading issues whatsoever: the only reason
to "fear" making loopback connections is that you may end up starving
your remote clients.

If performance is in question, running multiple Tomcat instances won't
change anything (it'll actually make it worse, since each JVM has a
minimum required footprint) because you'll be handling the exact same
number of requests regardless of deployment strategy, and all those
requests will require the same amount of resources.

If you can't handle your load, you'll have to scale horizontally.
Fortunately, Solr was made to scale horizontally :)

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk2ctXEACgkQ9CaO5/Lv0PDc4QCgvuMpXdFlY2OPKs1dq1/8Fm5x
zwIAnjXorMR/xhmHOywP4HjfWNedPcBI
=X930
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message