Hi Alvin,
Thank you posting the sources on www for the test.
The JDK java.util.GregorianCalendar class is *very* expensive,
each time you call get(Calendar.someConstant) it re-parse the Date
object, being so very expensive..
the following should be faster:
declare a local DateFormat variable within servlet:
java.text.SimpleDateFormat sdf =
new java.text.SimpleDateFormat("dd MMMMM, yyyy");
And print the date with the following call, that returns a string:
sdf.format(dateInstance);
Instead of the code that uses GregorianCalendar..
More improvement you should get if you handle to reduce println(s)
by declaring a local (or even static) String variable with
something like:
String documentHeader = "<HTML>\n" + ...
"<HEAD>" + ....
"<TITLE>...</TITLE>" +
///... blah, blah... what ever is "constant" within
// html page, until you use "dynamic" printing" ...
;
String documentFooter =... "</BODY>\n" + "</HTML>";
so within doPost you'll need only:
out.println(documentHeader);
... print here your generated Date or SQL results.
out.println(documentFooter);
This will also clarify the doPost() or doGet() source from most
of their println(s);
----------------------------------------------------------
Also, if you use JDK1.1.7 make sure you use native_threads instead of
green_threads - even somewhere within JServ sources is stated that
the green_threads IO is blocking *all* concurent threads
doing IO during networking reads, that may seriously affect multithreading
servlet performance.
------------------------------------------------------------
In order to consider JMeter as a fair measurement tool it needs to:
- be *much* faster than the server it tries to measure the performance.
Some servers are so fast that the results of jmeter (or other
web-benchmark tool) measure only the speed at wich JMeter *itself*
is able to send requests to and receive replies from that server.(!!!)
- run it from multiple client machines to make sure you fully stress
one server engine. Add the results from multiple JMeter(s)
- must not run on the same computer as the web (servlet, php) server.
JMeter has its own cpu% demands, possibly high, that will
alter the result of the benchmark, by taking CPU cycles from the
server process it benchmarks!!
Considering that both JMeter and servlet engine are used for
similar task (multithreaded Java networking) AND at the same time
JMeter uses AWT GUI for realtime displays, how can you be sure that JMeter
itself isnt an limiting factor in measuring a server's performance?
(I'm interested also in what Apache-JMeter developers answer at this
question, if they receive messages from this servlet-interest list)
---------------
Bye,
Cezar.
------------------------
"Contrary to popular belief, penguins are not the salvation of modern
technology. Neither do they throw parties for the urban proletariat."
On Mon, 19 Jul 1999, Alvin, lau wrote:
> >What are the results jswdk vs. jserv+apache on the same JVM (blackdown) ?
> you can see the result at
> http://achilles.stachanov.com/~alvin/lab/phpvsservlet/
>
>
> >More questions, more details please:
> >The error occurs within jmeter or at the servlet side?
>
> I cannot remember. I reinstalled blackdown jdk and glibc 2.0, so I cannot do
> that test again.
>
> >Try to use other jdk than ibm's for jmeter.
> yes, I tried (blackdown jdk1.1.7), and it worked.
>
> >Are you running jmeter on a different machine?
> >(otherwise the jmeter itself will alter the result of the benchmark).
> yes, i'm using the same machine.
>
>
> >Thanks,
> >Cezar.
> >
> >On Mon, 19 Jul 1999, Alvin, lau wrote:
> >
> >> hi,
> >>
> >> I spent almost 4 hrs to setup ibm vm (because I have to upgrade my
> glibc).
> >> After that, I started to do the test again. This time, I got an exception
> >> from jmeter and some error in my jserv's log. I tried to use jswdk
> instead
> >> of jserv, I still got that exception(I forget the name). I didn't have
> any
> >> problem when I used ie/ns to request that page and I didn't have any
> problem
> >> when I used blackdown jdk1.1.7. Why? Is there anyone using IBM VM, jserv
> on
> >> a linux box (suse 6.1)? It seems that IBM VM has some problems when a
> >> servlet is requested simultaneously or intensely.
> >>
> >> I am trying to ask some members of my team to use servlet, I need some
> >> figures to show that servlet is better. I do think servlet is better. But
> >> the fact is that they want to see. I cannot tell them if we use an
> expensive
> >> machine, then servlet is better. How can I ask them to use servlet on a
> big
> >> project when it doesn't handle a small project well.
> >>
> >> I'm going to do another test. And I hope this time java will win.
> >>
> >> rmi->servlet(apache, jserv)->client
> >> php(apache)->php(apache)->client
> >>
> >> I will post the results here when i finish.
> >>
> >> alvin
> >>
> >> -----Original Message-----
> >> From: Nic Ferrier <[EMAIL PROTECTED]>
> >> To: [EMAIL PROTECTED] <[EMAIL PROTECTED]>
> >> Date: zondag 18 juli 1999 4:53
> >> Subject: Re: Fw: (is servlet really faster?) Php
> >> VsServlet,unexpectedresult,why?
> >>
> >>
> >> >>>> "Alvin, lau" <[EMAIL PROTECTED]> 7/12/99 9:41:02 AM >>>
> >> >>hi nic,
> >> >
> >> >Hi Alvin
> >> >
> >> >>Okay, let me change the question, how can i make servlet run faster
> >> >than
> >> >>php? Which vm i have to use than, I'm using the one from
> >> >blackdown(1.1.7),
> >> >>is the one from ibm faster? do i have to change the servlet engine
> >> >like
> >> >>jrun(I'm using jserv, and jswdk-ea)?
> >> >
> >> >There are many issues other than VM as well.
> >> >
> >> >See Cezar's recent mail in reply to your message (his point about the
> >> >architecture of PHP is a good one).
> >> >
> >> >One of the most important things for us at BT was using Sun
> >> >hardware.
> >> >
> >> >I hate to say it, because I am a real exponent of free software, but
> >> >IMHO the best platform to run Java on is Sun.
> >> >
> >> >There VM is the fastest I've ever seen, but I must admit, I don't
> >> >know much about IBMs.
> >> >
> >> >There are lots of other things in addition to what Cezar has said:
> >> >
> >> >- Java's maths is faster than PHP
> >> >- the language is richer (most of Talk21 is actually static data, I
> >> >challenge you to do this in PHP)
> >> >- the link to native code for real performance is improved depending
> >> >on the version of the libraries you use (that's why Sun's is soooo
> >> >good)
> >> >- thread control is easy peasy and fast
> >> >
> >> >I could go on but the list is creaking already and the last thing it
> >> >needs is my hot air.
> >> >
> >> >If I were you I would do a more complicated test and run 70 or 100
> >> >connections at it over a period of some time (hours).
> >> >
> >> >See how stable the two are in comparison and I bet with a more
> >> >complicated test (let alone a new VM) you're servlets will go
> >> >quicker.
> >> >
> >> >
> >> >Nic
> >> >
> >>
> >___________________________________________________________________________
> >> >To unsubscribe, send email to [EMAIL PROTECTED] and include in the
> body
> >> >of the message "signoff SERVLET-INTEREST".
> >> >
> >> >Archives: http://archives.java.sun.com/archives/servlet-interest.html
> >> >Resources: http://java.sun.com/products/servlet/external-resources.html
> >> >LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
> >> >
> >>
> >>
> >
> >___________________________________________________________________________
> >To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
> >of the message "signoff SERVLET-INTEREST".
> >
> >Archives: http://archives.java.sun.com/archives/servlet-interest.html
> >Resources: http://java.sun.com/products/servlet/external-resources.html
> >LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
> >
>
> ___________________________________________________________________________
> To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
> of the message "signoff SERVLET-INTEREST".
>
> Archives: http://archives.java.sun.com/archives/servlet-interest.html
> Resources: http://java.sun.com/products/servlet/external-resources.html
> LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
>
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html