2

I'm using tomcat 5.5 for serving more that 100 sites(suppose my-gwt-site-1.com to my-gwt-site-100.com).
All of my sites are using a single instance of a previously deployed gwt application, the only deference between them is in their "Host" configuration section in server.xml :

<Host name="my-gwt-site-1.com" appBase="webapps">
<Context path="" reloadable="true" docBase="/my-gwt-app/" debug="1"
unpackWARs="false" autoDeploy="false" xmlValidation="false" xmlNamespaceAware="false" crossContext="true">

<Resource name="jdbc/mysql/db_1" auth="Container" type="javax.sql.DataSource"

initialSize="2" maxActive="50" maxIdle="5" 
maxWait="15000" removeAbandoned="true" removeAbandonedTimeout="2"
validationQuery="select now();"

username="root" password="pass" driverClassName="com.mysql.jdbc.Driver"
url="jdbc:mysql://localhost:3306/db_1"
/>
</Context>

& it repats fot all of my sites...

<Host name="my-gwt-site-100.com" appBase="webapps">
<Context path="" reloadable="true" docBase="/my-gwt-app/" debug="1"
unpackWARs="false" autoDeploy="false" xmlValidation="false" xmlNamespaceAware="false" crossContext="true">

<Resource name="jdbc/mysql/db_100" auth="Container" type="javax.sql.DataSource"

initialSize="2" maxActive="50" maxIdle="5" 
maxWait="15000" removeAbandoned="true" removeAbandonedTimeout="2"
validationQuery="select now();"

username="root" password="pass" driverClassName="com.mysql.jdbc.Driver"
url="jdbc:mysql://localhost:3306/db_100"
/>
</Context>

the only reason I do this is because my application needs to use the separate resource for every domain.
when number "host" sections in server.xml is about 5, the is no problem, but when it grows up to about 10 or more, the tomcat server starts successfully but it cant load any of my site(seems that it crashes in the background silently!)
I want to know is this a good solution to add a lot of "host" tags in server.xml or there is any better way to do this? Attention that I Just want to use one code with separate databases for all of my sites.
Another question is that how many java sites(each one with about 500 users and low traffic) usually can be run on a single server(with 2 Quand Core CPUs & 4GB of RAM)?

4

0 回答 0