0

I would like to know if anybody has experience with the following scenario:

  • linux console based, deamon-like application, running in infinite loop, taking some data from stdin, processing data, outputting some data to stdout

I'm not asking for compilation performance. Application is going to be run for about 24 hours then restarted. In both cases application is compiled and run inside some kind of virtual machine, php-runtime and JVM.

The question is what will be the difference in performance of that application written in PHP and in Java.

I have such application in PHP but wondering is it worth to spend a time to rewrite it to Java.

5
  • 1
    "It depends". And if the difference even matters ... "depends". (I would expect Java on a modern JVM to be consistently faster at "running" the code. However, the bottle-neck may be somewhere else, such as a database.) Commented Apr 20, 2011 at 17:35
  • Application is connected to MySQL database, both PHP and Java will use exactly the same queries and the same logic of processing results.I belive that there will be no difference between mysql_query(query1) and statement.executeQuery(query1) if queries and result sets are the same. Commented Apr 20, 2011 at 17:54
  • So, back to the beginning: "it depends". I would expect less a practical difference for a database-bound application. Benchmark analysis is required to determine any applicable performance/bottle-neck. While I don't encourage the use of PHP, "If it's not broken..." (switching to language X might have other benefits, but a cost/benefit analysis should be done) Commented Apr 20, 2011 at 17:57
  • Sure, I can spend several days rewriting app to Java and then make some benchmarks. But that's reason of posting here my question - I would like to know is it worth to do this. Commented Apr 20, 2011 at 18:05
  • 1
    "It depends". See above. The Java application should be no slower (although it may consume more memory and have a longer 'warmup' phase). How much faster (if any) it is, depends on a number of factors that can't be adequately answered here. Ergo, "it depends" although less gains will generally be seen in IO-bound applications. Remember to utilize buffers for IO appropriately (in Java or PHP). Commented Apr 20, 2011 at 18:06

1 Answer 1

1

This will depend on your requirements. How fast does it need to run? Is it currently running within acceptable parameters? Will it have an increase in usage? Will that increase cause it to fall outside the threshold of speed?

That being said, drive space is cheaper than memory. If you already have it working, keep PHP.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.