tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From M Butcher <mbutch...@uswest.net>
Subject Re: OT: java programming Q
Date Wed, 10 May 2000 16:02:37 GMT
I wouldn't think you'd lose _that_ much to performance time... you _are_
creating a new process, and that will take time (and resources), but not much.
Unless this app is bearing a large load, I wouldn't worry too much about that.

Performance-wise, I hear that Java is faster an C++ when given a good compiler
and VM (which are capable of making more runtime optimizations than a compiler
alone). However, I have seen cases where apps are faster in C. The best way of
mixing is probably JNI. If this app is going to cary a large load, and the C is
either too significant to rewrite or faster than a Java version, JNI is probably
the way to go in the long run.

Viehl Clemens wrote:

> > The only thing I'm still wondering about is how I can for example
> > make the C program sending it's stdout to
> > PrintWriter out = response.getWriter(); , in other words, can
> > I write a
> > C program cprog or bourne shell script:
> > main() { printf("<HTML>Hello World</HTML>"};
> >
> > and exec this C program from within the servlet
> >
>
> > String action="cprog";
> > Runtime runner= Runtime.getRuntime();
> > runner.exec(action);
> >
> > This doesn't seem to work. And I havn't yet found where the output
> > goes at all.
>
> runner.exec returns a process.
> Write:
>
>   Runtime runtime = Runtime.getRuntime ();
>   Process process = runtime.exec (action);
>
>   InputStream in  = process.getInputStream ();
>   InputStream err = process.getErrorStream ();
>
> This should work.
>
> > > > But for efficiency reasons there's a lot I'd still prefer
> > > > to be done with CGI
> > > > programs (C programs).
>
> But i believe you will get a really bad performance using CGI within
> Servlets.
> Servlets are the replacement for such things and are more performant because
> you
> don't need to create a Operating System process as you have with CGIs. But
> i'm not sure about this, because i know only servlets. But they are Java
> Threads who are present prompt after their first initialization.
> Java isn't too slow when you don't have a gui. Try a fast JVM, that would
> improve speed more than mixing C and Java.
> Just my 2 cent.
>
> Regards
>
> Clemens Viehl
>
> --------------------------------------------------------------------------
> To unsubscribe, email: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commmands, email: tomcat-user-help@jakarta.apache.org

--
M Butcher
mailto:mbutcher@<NOSPAM>xleration.com



Mime
View raw message