You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by tim leung <ch...@yahoo.com> on 2001/05/05 20:39:06 UTC

JAVA vs. PERL startup time + memory

Hi,
I am thinking of write an unix app that will get data
from a pipe  e.g.  |       and then will do a HTTP
POST to some server.

e.g.  command1 xxxx  |  java PipeReader    -- OR --
e.g.  command1 xxxx |  perl PipeReader

Assume I need to invoke the JVM process or PERL
process very frequently ( 5 times / sec ) --> ( 300
times / min )

I know that Java's startup time is slow. and it
allocation a block of per-defined memory when it
starts up.  like 2MB. although it may only
use 300KB.  so. I think start a JVM process is SLOW
and need lots of
memory.

I am not very familiar with PERL. I wonder if I invoke
300 PERL process / min, is it faster and use less
memory than invoke 300 JVM process / min? 

Both will do the same thing.--> each time it's'
invoked, it will do a HTTP POST of some data get from
the pipe ( stdin ) and then System.exit(). 

thanks.

__________________________________________________
Do You Yahoo!?
Yahoo! Auctions - buy the things you want at great prices
http://auctions.yahoo.com/

RE: JAVA vs. PERL startup time + memory

Posted by Danny Angus <da...@thought.co.uk>.
Perl can be small, and relatively fast, apache cgi invocations of perl
scripts (mod-cgi not mod-perl) load the  perl "engine"(whatever it might be
called, interpreter/VM/JITcompiler) for every process, as far as I know
anyway, hence the rise of mod-perl which caches the compiled perl scripts
and the "engine" in RAM between requests for a faster startup, or so I
understand.

Don't know how to deal with pipeing to a daemon though, without invoking a
messaging process and defeating the purpose of the daemon. If you know that
one, then perl does http & regex quite well (assuming you need to build your
requests out of the input), but java does threads and OO nicely.


> -----Original Message-----
> From: Jeff Kilbride [mailto:jeff@kilbride.com]
> Sent: Saturday, May 05, 2001 8:44 PM
> To: tomcat-user@jakarta.apache.org
> Subject: Re: JAVA vs. PERL startup time + memory
>
>
> Wouldn't it be easier to create a daemon of some sort that stays
> loaded and
> accepts requests, rather than creating a new process each time?
> Whether you
> use Java or Perl, this will make a much bigger performance difference than
> the language itself. If you must write something that creates a
> new process,
> my only recommendation would be to do it in a non-interpreted
> language (i.e.
> C, C++, etc...) to avoid the overhead of the interpreter.
>
> The nice thing about Java is that it's relatively simple to create a
> multi-threaded daemon.
>
> --jeff
>
> ----- Original Message -----
> From: "tim leung" <ch...@yahoo.com>
> To: <to...@jakarta.apache.org>
> Sent: Saturday, May 05, 2001 11:39 AM
> Subject: JAVA vs. PERL startup time + memory
>
>
> > Hi,
> > I am thinking of write an unix app that will get data
> > from a pipe  e.g.  |       and then will do a HTTP
> > POST to some server.
> >
> > e.g.  command1 xxxx  |  java PipeReader    -- OR --
> > e.g.  command1 xxxx |  perl PipeReader
> >
> > Assume I need to invoke the JVM process or PERL
> > process very frequently ( 5 times / sec ) --> ( 300
> > times / min )
> >
> > I know that Java's startup time is slow. and it
> > allocation a block of per-defined memory when it
> > starts up.  like 2MB. although it may only
> > use 300KB.  so. I think start a JVM process is SLOW
> > and need lots of
> > memory.
> >
> > I am not very familiar with PERL. I wonder if I invoke
> > 300 PERL process / min, is it faster and use less
> > memory than invoke 300 JVM process / min?
> >
> > Both will do the same thing.--> each time it's'
> > invoked, it will do a HTTP POST of some data get from
> > the pipe ( stdin ) and then System.exit().
> >
> > thanks.
> >
> > __________________________________________________
> > Do You Yahoo!?
> > Yahoo! Auctions - buy the things you want at great prices
> > http://auctions.yahoo.com/
> >
>


Re: JAVA vs. PERL startup time + memory

Posted by Jeff Kilbride <je...@kilbride.com>.
Wouldn't it be easier to create a daemon of some sort that stays loaded and
accepts requests, rather than creating a new process each time? Whether you
use Java or Perl, this will make a much bigger performance difference than
the language itself. If you must write something that creates a new process,
my only recommendation would be to do it in a non-interpreted language (i.e.
C, C++, etc...) to avoid the overhead of the interpreter.

The nice thing about Java is that it's relatively simple to create a
multi-threaded daemon.

--jeff

----- Original Message -----
From: "tim leung" <ch...@yahoo.com>
To: <to...@jakarta.apache.org>
Sent: Saturday, May 05, 2001 11:39 AM
Subject: JAVA vs. PERL startup time + memory


> Hi,
> I am thinking of write an unix app that will get data
> from a pipe  e.g.  |       and then will do a HTTP
> POST to some server.
>
> e.g.  command1 xxxx  |  java PipeReader    -- OR --
> e.g.  command1 xxxx |  perl PipeReader
>
> Assume I need to invoke the JVM process or PERL
> process very frequently ( 5 times / sec ) --> ( 300
> times / min )
>
> I know that Java's startup time is slow. and it
> allocation a block of per-defined memory when it
> starts up.  like 2MB. although it may only
> use 300KB.  so. I think start a JVM process is SLOW
> and need lots of
> memory.
>
> I am not very familiar with PERL. I wonder if I invoke
> 300 PERL process / min, is it faster and use less
> memory than invoke 300 JVM process / min?
>
> Both will do the same thing.--> each time it's'
> invoked, it will do a HTTP POST of some data get from
> the pipe ( stdin ) and then System.exit().
>
> thanks.
>
> __________________________________________________
> Do You Yahoo!?
> Yahoo! Auctions - buy the things you want at great prices
> http://auctions.yahoo.com/
>


Re: JAVA vs. PERL startup time + memory

Posted by tim leung <ch...@yahoo.com>.
Thanks James,
You had solve my problem i had stuck for a month.  You
are right !!! Apache spawn only one CustomLog process.
 

But it seems like Apache's "Log to pipe" feature only
works on unix.  When i try to pipe the log to a java
application in windows, it seems not working.

on unix:
  CustomLog "|java -classpath /opt pipe" common
on windows 2000:
  CustomLog "|java -classpath d:\ pipe" common
  // doesn't work in windows

I had verfiy the classpath and java path is right by
runing the java app in windows terminal.

more comment would be more than welcome.
thanks.


--- James Klicman <ja...@jsptags.com> wrote:
> 
> Choose whichever language you want and don't worry.
> 
> Apache will spawn only one CustomLog process for all
> log records. It
> will only start a new process if the pipe hangs or
> the log process
> dies. It would be ridiculously inefficient if Apache
> spawned a new
> process to log each record.
> 
> -James
> 
> 
> On Sat, May 05, 2001 at 06:07:52PM -0700, tim leung
> wrote:
> > My problem is I must use unix pipe.
> > e.g. command1 xxxx | command2 xxxx
> > 
> > where command1 is some unix command.
> > where command2 is "java PipeReader"
> > 
> > that is output of command1 sent to input of java
> > application -- PipeReader.  
> > 
> > why I must use pipe?
> > because I am using apache web server.  apache
> server
> > will do logging to a text file.  instead of log to
> > text file. I can also log to a pipe :
> > 
> >   // apache server log to a pipe instead of log
> file
> >   e.g. CustomLog "|java -classpath /opt pipe"
> common
> > 
> > I pipe the log's (byte sent) / sessionID ....
> etc...
> > to the application and the application will HTTP
> POST
> > the log back to servlet for further processing.
> > 
> > the suggestion of unix pipe to a running process
> > (daemon) is what I really want to do but i dont'
> think
> > there is a way to do it.  inorder to pipe the
> > command1's Output to java app PipeReader's Input
> > (stdin).  I must invoke a new JVM process inorder
> to
> > do pipe.  right? 
> > 
> > any one can help me out?
> > thanks.
> > 
> > --- Ross Dyson <rd...@reef.com> wrote:
> > > The JVM is loaded just ONCE not once pre
> request.
> > > 
> > > This is WHY java back-ends have better
> performance
> > > and are scalable.
> > > 
> > > -----Original Message-----
> > > From: tim leung [mailto:chiu04us@yahoo.com]
> > > Sent: Sunday, 6 May 2001 4:39 AM
> > > To: tomcat-user@jakarta.apache.org
> > > Subject: JAVA vs. PERL startup time + memory
> > > 
> > > 
> > > Hi,
> > > I am thinking of write an unix app that will get
> > > data
> > > from a pipe  e.g.  |       and then will do a
> HTTP
> > > POST to some server.
> > > 
> > > e.g.  command1 xxxx  |  java PipeReader    -- OR
> --
> > > e.g.  command1 xxxx |  perl PipeReader
> > > 
> > > Assume I need to invoke the JVM process or PERL
> > > process very frequently ( 5 times / sec ) --> (
> 300
> > > times / min )
> > > 
> > > I know that Java's startup time is slow. and it
> > > allocation a block of per-defined memory when it
> > > starts up.  like 2MB. although it may only
> > > use 300KB.  so. I think start a JVM process is
> SLOW
> > > and need lots of
> > > memory.
> > > 
> > > I am not very familiar with PERL. I wonder if I
> > > invoke
> > > 300 PERL process / min, is it faster and use
> less
> > > memory than invoke 300 JVM process / min? 
> > > 
> > > Both will do the same thing.--> each time it's'
> > > invoked, it will do a HTTP POST of some data get
> > > from
> > > the pipe ( stdin ) and then System.exit(). 
> > > 
> > > thanks.
> > > 
> > >
> __________________________________________________
> > > Do You Yahoo!?
> > > Yahoo! Auctions - buy the things you want at
> great
> > > prices
> > > http://auctions.yahoo.com/
> > 
> > 
> > __________________________________________________
> > Do You Yahoo!?
> > Yahoo! Auctions - buy the things you want at great
> prices
> > http://auctions.yahoo.com/


__________________________________________________
Do You Yahoo!?
Yahoo! Auctions - buy the things you want at great prices
http://auctions.yahoo.com/

Re: JAVA vs. PERL startup time + memory

Posted by tim leung <ch...@yahoo.com>.
Thanks James,
You had solve my problem i had stuck for a month.  You
are right !!! Apache spawn only one CustomLog process.
 

But it seems like Apache's "Log to pipe" feature only
works on unix.  When i try to pipe the log to a java
application in windows, it seems not working.

on unix:
  CustomLog "|java -classpath /opt pipe" common
on windows 2000:
  CustomLog "|java -classpath d:\ pipe" common
  // doesn't work in windows

I had verfiy the classpath and java path is right by
runing the java app in windows terminal.

more comment would be more than welcome.
thanks.


--- James Klicman <ja...@jsptags.com> wrote:
> 
> Choose whichever language you want and don't worry.
> 
> Apache will spawn only one CustomLog process for all
> log records. It
> will only start a new process if the pipe hangs or
> the log process
> dies. It would be ridiculously inefficient if Apache
> spawned a new
> process to log each record.
> 
> -James
> 
> 
> On Sat, May 05, 2001 at 06:07:52PM -0700, tim leung
> wrote:
> > My problem is I must use unix pipe.
> > e.g. command1 xxxx | command2 xxxx
> > 
> > where command1 is some unix command.
> > where command2 is "java PipeReader"
> > 
> > that is output of command1 sent to input of java
> > application -- PipeReader.  
> > 
> > why I must use pipe?
> > because I am using apache web server.  apache
> server
> > will do logging to a text file.  instead of log to
> > text file. I can also log to a pipe :
> > 
> >   // apache server log to a pipe instead of log
> file
> >   e.g. CustomLog "|java -classpath /opt pipe"
> common
> > 
> > I pipe the log's (byte sent) / sessionID ....
> etc...
> > to the application and the application will HTTP
> POST
> > the log back to servlet for further processing.
> > 
> > the suggestion of unix pipe to a running process
> > (daemon) is what I really want to do but i dont'
> think
> > there is a way to do it.  inorder to pipe the
> > command1's Output to java app PipeReader's Input
> > (stdin).  I must invoke a new JVM process inorder
> to
> > do pipe.  right? 
> > 
> > any one can help me out?
> > thanks.
> > 
> > --- Ross Dyson <rd...@reef.com> wrote:
> > > The JVM is loaded just ONCE not once pre
> request.
> > > 
> > > This is WHY java back-ends have better
> performance
> > > and are scalable.
> > > 
> > > -----Original Message-----
> > > From: tim leung [mailto:chiu04us@yahoo.com]
> > > Sent: Sunday, 6 May 2001 4:39 AM
> > > To: tomcat-user@jakarta.apache.org
> > > Subject: JAVA vs. PERL startup time + memory
> > > 
> > > 
> > > Hi,
> > > I am thinking of write an unix app that will get
> > > data
> > > from a pipe  e.g.  |       and then will do a
> HTTP
> > > POST to some server.
> > > 
> > > e.g.  command1 xxxx  |  java PipeReader    -- OR
> --
> > > e.g.  command1 xxxx |  perl PipeReader
> > > 
> > > Assume I need to invoke the JVM process or PERL
> > > process very frequently ( 5 times / sec ) --> (
> 300
> > > times / min )
> > > 
> > > I know that Java's startup time is slow. and it
> > > allocation a block of per-defined memory when it
> > > starts up.  like 2MB. although it may only
> > > use 300KB.  so. I think start a JVM process is
> SLOW
> > > and need lots of
> > > memory.
> > > 
> > > I am not very familiar with PERL. I wonder if I
> > > invoke
> > > 300 PERL process / min, is it faster and use
> less
> > > memory than invoke 300 JVM process / min? 
> > > 
> > > Both will do the same thing.--> each time it's'
> > > invoked, it will do a HTTP POST of some data get
> > > from
> > > the pipe ( stdin ) and then System.exit(). 
> > > 
> > > thanks.
> > > 
> > >
> __________________________________________________
> > > Do You Yahoo!?
> > > Yahoo! Auctions - buy the things you want at
> great
> > > prices
> > > http://auctions.yahoo.com/
> > 
> > 
> > __________________________________________________
> > Do You Yahoo!?
> > Yahoo! Auctions - buy the things you want at great
> prices
> > http://auctions.yahoo.com/


__________________________________________________
Do You Yahoo!?
Yahoo! Auctions - buy the things you want at great prices
http://auctions.yahoo.com/

Re: JAVA vs. PERL startup time + memory

Posted by James Klicman <ja...@jsptags.com>.
Choose whichever language you want and don't worry.

Apache will spawn only one CustomLog process for all log records. It
will only start a new process if the pipe hangs or the log process
dies. It would be ridiculously inefficient if Apache spawned a new
process to log each record.

-James


On Sat, May 05, 2001 at 06:07:52PM -0700, tim leung wrote:
> My problem is I must use unix pipe.
> e.g. command1 xxxx | command2 xxxx
> 
> where command1 is some unix command.
> where command2 is "java PipeReader"
> 
> that is output of command1 sent to input of java
> application -- PipeReader.  
> 
> why I must use pipe?
> because I am using apache web server.  apache server
> will do logging to a text file.  instead of log to
> text file. I can also log to a pipe :
> 
>   // apache server log to a pipe instead of log file
>   e.g. CustomLog "|java -classpath /opt pipe" common
> 
> I pipe the log's (byte sent) / sessionID .... etc...
> to the application and the application will HTTP POST
> the log back to servlet for further processing.
> 
> the suggestion of unix pipe to a running process
> (daemon) is what I really want to do but i dont' think
> there is a way to do it.  inorder to pipe the
> command1's Output to java app PipeReader's Input
> (stdin).  I must invoke a new JVM process inorder to
> do pipe.  right? 
> 
> any one can help me out?
> thanks.
> 
> --- Ross Dyson <rd...@reef.com> wrote:
> > The JVM is loaded just ONCE not once pre request.
> > 
> > This is WHY java back-ends have better performance
> > and are scalable.
> > 
> > -----Original Message-----
> > From: tim leung [mailto:chiu04us@yahoo.com]
> > Sent: Sunday, 6 May 2001 4:39 AM
> > To: tomcat-user@jakarta.apache.org
> > Subject: JAVA vs. PERL startup time + memory
> > 
> > 
> > Hi,
> > I am thinking of write an unix app that will get
> > data
> > from a pipe  e.g.  |       and then will do a HTTP
> > POST to some server.
> > 
> > e.g.  command1 xxxx  |  java PipeReader    -- OR --
> > e.g.  command1 xxxx |  perl PipeReader
> > 
> > Assume I need to invoke the JVM process or PERL
> > process very frequently ( 5 times / sec ) --> ( 300
> > times / min )
> > 
> > I know that Java's startup time is slow. and it
> > allocation a block of per-defined memory when it
> > starts up.  like 2MB. although it may only
> > use 300KB.  so. I think start a JVM process is SLOW
> > and need lots of
> > memory.
> > 
> > I am not very familiar with PERL. I wonder if I
> > invoke
> > 300 PERL process / min, is it faster and use less
> > memory than invoke 300 JVM process / min? 
> > 
> > Both will do the same thing.--> each time it's'
> > invoked, it will do a HTTP POST of some data get
> > from
> > the pipe ( stdin ) and then System.exit(). 
> > 
> > thanks.
> > 
> > __________________________________________________
> > Do You Yahoo!?
> > Yahoo! Auctions - buy the things you want at great
> > prices
> > http://auctions.yahoo.com/
> 
> 
> __________________________________________________
> Do You Yahoo!?
> Yahoo! Auctions - buy the things you want at great prices
> http://auctions.yahoo.com/

Re: JAVA vs. PERL startup time + memory

Posted by David Crooke <da...@convio.com>.
It's perfectly easy to write code which runs as a process to read a continuous
pipe, or to write it to be invoked fresh every time. No special knowledge is
needed in either case (the former in Perl boils down to "while (<STDIN>)")

I think you'll get better advice if you post more details about what you're
trying to achieve. Also, this isn't really the forum to ask this question, since
its not about configuring and using Tomcat.

That said, I'm guessing you're trying to take a log file feed from Apache and
then post it back - first of all, be careful of creating an infinite loop! It
sounds like an awkward way to do things. If you want to take log data for a Java
web application and make it available via another servlet, it's better to use a
mechanism other than HTTP to talk back to yourself; e.g. open a separate i/o
stream in Tomcat and create a separate log process which will speak to it via a
pipe stream or TCP/IP. One sneaky way to do this might be to start a JVM running
your own logging program, and have it fork a thread to run Tomcat's main() on
startup. Thus you end up with the logger and Tomcat in the same JVM, and the act
of Apache fork()ing the logger sets up the pipe you need.

Depending on what you're trying to do, it may be easier just to subclass all
your servlets off a common base class which logs servlet activity completely
within the JVM.

One thing you definitely *don't* want to do is start a JVM for every request -
JVM's have a pretty high startup overhead, at least a couple of seconds of CPU.
If you want to create a small program or script that runs very frequently, Perl
is a good choice, but the best way is to use a statically compiled language with
minimal startup overhead such as C.

Cheers
Dave

tim leung wrote:

> My problem is I must use unix pipe.
> e.g. command1 xxxx | command2 xxxx
>
> where command1 is some unix command.
> where command2 is "java PipeReader"
>
> that is output of command1 sent to input of java
> application -- PipeReader.
>
> why I must use pipe?
> because I am using apache web server.  apache server
> will do logging to a text file.  instead of log to
> text file. I can also log to a pipe :
>
>   // apache server log to a pipe instead of log file
>   e.g. CustomLog "|java -classpath /opt pipe" common
>
> I pipe the log's (byte sent) / sessionID .... etc...
> to the application and the application will HTTP POST
> the log back to servlet for further processing.
>
> the suggestion of unix pipe to a running process
> (daemon) is what I really want to do but i dont' think
> there is a way to do it.  inorder to pipe the
> command1's Output to java app PipeReader's Input
> (stdin).  I must invoke a new JVM process inorder to
> do pipe.  right?
>
> any one can help me out?
> thanks.
>
> --- Ross Dyson <rd...@reef.com> wrote:
> > The JVM is loaded just ONCE not once pre request.
> >
> > This is WHY java back-ends have better performance
> > and are scalable.
> >
> > -----Original Message-----
> > From: tim leung [mailto:chiu04us@yahoo.com]
> > Sent: Sunday, 6 May 2001 4:39 AM
> > To: tomcat-user@jakarta.apache.org
> > Subject: JAVA vs. PERL startup time + memory
> >
> >
> > Hi,
> > I am thinking of write an unix app that will get
> > data
> > from a pipe  e.g.  |       and then will do a HTTP
> > POST to some server.
> >
> > e.g.  command1 xxxx  |  java PipeReader    -- OR --
> > e.g.  command1 xxxx |  perl PipeReader
> >
> > Assume I need to invoke the JVM process or PERL
> > process very frequently ( 5 times / sec ) --> ( 300
> > times / min )
> >
> > I know that Java's startup time is slow. and it
> > allocation a block of per-defined memory when it
> > starts up.  like 2MB. although it may only
> > use 300KB.  so. I think start a JVM process is SLOW
> > and need lots of
> > memory.
> >
> > I am not very familiar with PERL. I wonder if I
> > invoke
> > 300 PERL process / min, is it faster and use less
> > memory than invoke 300 JVM process / min?
> >
> > Both will do the same thing.--> each time it's'
> > invoked, it will do a HTTP POST of some data get
> > from
> > the pipe ( stdin ) and then System.exit().
> >
> > thanks.
> >
> > __________________________________________________
> > Do You Yahoo!?
> > Yahoo! Auctions - buy the things you want at great
> > prices
> > http://auctions.yahoo.com/
>
> __________________________________________________
> Do You Yahoo!?
> Yahoo! Auctions - buy the things you want at great prices
> http://auctions.yahoo.com/


Re: JAVA vs. PERL startup time + memory

Posted by Eric Fialkowski <er...@micron.net>.
Just one idea that isn't completely thought through so forgive me if this is
ludicrous....

How about piping the output from the log into a FIFO/named pipe (read the
man page for mknod if you're not sure what that is).  Then you could have a
background process that is reading from the pipe.  That way, the process
should only need to be started once.




RE: JAVA vs. PERL startup time + memory

Posted by tim leung <ch...@yahoo.com>.
My problem is I must use unix pipe.
e.g. command1 xxxx | command2 xxxx

where command1 is some unix command.
where command2 is "java PipeReader"

that is output of command1 sent to input of java
application -- PipeReader.  

why I must use pipe?
because I am using apache web server.  apache server
will do logging to a text file.  instead of log to
text file. I can also log to a pipe :

  // apache server log to a pipe instead of log file
  e.g. CustomLog "|java -classpath /opt pipe" common

I pipe the log's (byte sent) / sessionID .... etc...
to the application and the application will HTTP POST
the log back to servlet for further processing.

the suggestion of unix pipe to a running process
(daemon) is what I really want to do but i dont' think
there is a way to do it.  inorder to pipe the
command1's Output to java app PipeReader's Input
(stdin).  I must invoke a new JVM process inorder to
do pipe.  right? 

any one can help me out?
thanks.

--- Ross Dyson <rd...@reef.com> wrote:
> The JVM is loaded just ONCE not once pre request.
> 
> This is WHY java back-ends have better performance
> and are scalable.
> 
> -----Original Message-----
> From: tim leung [mailto:chiu04us@yahoo.com]
> Sent: Sunday, 6 May 2001 4:39 AM
> To: tomcat-user@jakarta.apache.org
> Subject: JAVA vs. PERL startup time + memory
> 
> 
> Hi,
> I am thinking of write an unix app that will get
> data
> from a pipe  e.g.  |       and then will do a HTTP
> POST to some server.
> 
> e.g.  command1 xxxx  |  java PipeReader    -- OR --
> e.g.  command1 xxxx |  perl PipeReader
> 
> Assume I need to invoke the JVM process or PERL
> process very frequently ( 5 times / sec ) --> ( 300
> times / min )
> 
> I know that Java's startup time is slow. and it
> allocation a block of per-defined memory when it
> starts up.  like 2MB. although it may only
> use 300KB.  so. I think start a JVM process is SLOW
> and need lots of
> memory.
> 
> I am not very familiar with PERL. I wonder if I
> invoke
> 300 PERL process / min, is it faster and use less
> memory than invoke 300 JVM process / min? 
> 
> Both will do the same thing.--> each time it's'
> invoked, it will do a HTTP POST of some data get
> from
> the pipe ( stdin ) and then System.exit(). 
> 
> thanks.
> 
> __________________________________________________
> Do You Yahoo!?
> Yahoo! Auctions - buy the things you want at great
> prices
> http://auctions.yahoo.com/


__________________________________________________
Do You Yahoo!?
Yahoo! Auctions - buy the things you want at great prices
http://auctions.yahoo.com/

RE: JAVA vs. PERL startup time + memory

Posted by Ross Dyson <rd...@reef.com>.
The JVM is loaded just ONCE not once pre request.

This is WHY java back-ends have better performance and are scalable.

-----Original Message-----
From: tim leung [mailto:chiu04us@yahoo.com]
Sent: Sunday, 6 May 2001 4:39 AM
To: tomcat-user@jakarta.apache.org
Subject: JAVA vs. PERL startup time + memory


Hi,
I am thinking of write an unix app that will get data
from a pipe  e.g.  |       and then will do a HTTP
POST to some server.

e.g.  command1 xxxx  |  java PipeReader    -- OR --
e.g.  command1 xxxx |  perl PipeReader

Assume I need to invoke the JVM process or PERL
process very frequently ( 5 times / sec ) --> ( 300
times / min )

I know that Java's startup time is slow. and it
allocation a block of per-defined memory when it
starts up.  like 2MB. although it may only
use 300KB.  so. I think start a JVM process is SLOW
and need lots of
memory.

I am not very familiar with PERL. I wonder if I invoke
300 PERL process / min, is it faster and use less
memory than invoke 300 JVM process / min? 

Both will do the same thing.--> each time it's'
invoked, it will do a HTTP POST of some data get from
the pipe ( stdin ) and then System.exit(). 

thanks.

__________________________________________________
Do You Yahoo!?
Yahoo! Auctions - buy the things you want at great prices
http://auctions.yahoo.com/