You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Michael McCutcheon <mi...@att.net> on 2011/04/05 08:56:45 UTC

Tomcat calling into itself

Hello,

I have a java webapp that is going to make calls to Solr.  Both the 
webapp and Solr will be on the same server.

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.

Would it be best to run 2 instances of tomcat (1 for webapp, another for 
Solr)?

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?

-Mike


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


Re: Tomcat calling into itself

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----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


Re: Tomcat calling into itself

Posted by André Warnier <aw...@ice-sa.com>.
Pid wrote:
> On 4/5/11 7:56 AM, Michael McCutcheon wrote:
>> Hello,
>>
>> I have a java webapp that is going to make calls to Solr.  Both the
>> webapp and Solr will be on the same server.
> 
> OK.  Note it's a good idea to tell us what exact OS, Java, Tomcat
> versions you're running.
> 
> 
>> 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.
> 
> Oh dear.  That's a quite vague description, so it's really impossible to
> say what it means.  Can you elaborate?
> 
> 
>> Would it be best to run 2 instances of tomcat (1 for webapp, another for
>> Solr)?
> 
> NEEDINFO
> 
> 
>> 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?
> 
> No idea.  If Solr has threading issues (I've not heard of any) you'd
> best ask that community.  Tomcat is not an OS or JVM, it doesn't manage
> all the threads in your app.
> 
> 
Right.   Plus, it is not really possible to answer these questions here, considering how 
many different types of configurations are possible with Solr and Lucene.  The OP really 
needs to ask on the Solr/Lucene lists, for what would be the most appropriate 
configuration for *his* use case.


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


Re: Tomcat calling into itself

Posted by Pid <pi...@pidster.com>.
On 4/5/11 7:56 AM, Michael McCutcheon wrote:
> Hello,
> 
> I have a java webapp that is going to make calls to Solr.  Both the
> webapp and Solr will be on the same server.

OK.  Note it's a good idea to tell us what exact OS, Java, Tomcat
versions you're running.


> 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.

Oh dear.  That's a quite vague description, so it's really impossible to
say what it means.  Can you elaborate?


> Would it be best to run 2 instances of tomcat (1 for webapp, another for
> Solr)?

NEEDINFO


> 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?

No idea.  If Solr has threading issues (I've not heard of any) you'd
best ask that community.  Tomcat is not an OS or JVM, it doesn't manage
all the threads in your app.


p

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