-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Nathan,

Nathan Thatcher wrote:
> I am porting an application from Windows to Linux which makes heavy use of
> servlets. I have a fairly intensive background process (currently a windows
> service) that requires no user interaction. I plan to rewrite the code in
> Java and I am wondering if there is any notable performance difference
> between running the Java code under Tomcat as opposed to running the code
> directly as a daemon.

Not really, but I don't see a compelling reason to run something under a
servlet container if it doesn't actually need to be running inside a
servlet container. Is also simplifies testing, deployment, etc if you
leave it separate.

> Since the application requires Tomcat, I know I can
> code it up as a servlet and kick off the processing in the init() function
> and not worry about executing the code directly as a daemon.

While this certainly will work (I'm assuming you're kicking-off a thread
to do this work), it's a pretty big hack ;)

> Since this is a
> performance sensitive process I want to make sure that I choose the optimal
> route.

So, you want to make sure that the process itself gets enough CPU time?
I think you want to be able to control this process separately from your
webapps. *NIX has finer-grained levels of process priority than
Microsoft Windows does (at least, those that are exposed to the user),
and you can use the program "nice" to run a job with higher or lower
priority (note there is no "mean" command... you just use a negative
"niceness" value).

> Does anybody know how java code running as a servlet compares
> performance-wise to the same code running as a daemon? Is one way generally
> better than the other?

Once your code starts up, there should be no performance difference
since you're not adding any overhead from the container (that is, you
don't have to use any of their classes or objects or anything). The only
problem is that it's running in the same JVM as the actual servlets in
your application.

I'd keep it as a separate application if I were you.

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

iEYEARECAAYFAkkjNTsACgkQ9CaO5/Lv0PBEogCfVE3yTS6SV/BSpK810P2XYtW/
HX8AoMKeCUSOK2tlDLHdVWLzGRtCUZaI
=Q41d
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to