Java vs. PHP Speed Comparison [closed]

Active3 hr before
Viewed126 times

2 Answers


Now let’s try 5000 concurrent connections (with N=1) - or as close to that as I could come. Unfortunately, for most of these environments, the failure rate was not insignificant. For this chart, we’ll look at the total number of requests per second. The higher the better:,First, let’s look at some low concurrency examples. Running 2000 iterations with 300 concurrent requests and only one hash per request (N=1) gives us this:,In this article, we’ll be comparing Node, Java, Go, and PHP with Apache, discussing how the different languages model their I/O, the advantages and disadvantages of each model, and conclude with some rudimentary benchmarks. If you’re concerned about the I/O performance of your next web application, this article is for you.,But what happens if we increase N to 1000, still with 300 concurrent requests - the same load but 100x more hash iterations (significantly more CPU load):

And of course the actual code is simply embedded right into your page, and operations are blocking:

< ? php

// blocking file I/O
$file_data = file_get_contents(‘/path/to / file.dat’);

// blocking network I/O
$curl = curl_init('');
$result = curl_exec($curl);

// some more blocking network I/O
$result = $db - > query('SELECT id, data FROM examples ORDER BY id DESC limit 100');

load more v

Null coalesce operator,Combined comparison operator,PHP Is Faster and Better Than Ever, Too,Number operators and malformed numbers

To be fair, that number is declining. In November 2017, W3Techs had PHP as the server-side language for 80.1% of websites. That number dropped to 79.6% in June 2018, and now it’s down to 78.9% when we’re publishing this post in November 2018.

However, you also have to take some of the statistics with a grain of salt. Some of these scanning tools simply look for the X-Powered-By HTTP header. Some hosting providers, including Kinsta, remove these headers from broadcasting on the server for security purposes. Therefore, the number of sites using PHP could, in fact, be higher.

X - Powered - By

Other "closed-undefined" queries related to "Java vs. PHP Speed Comparison [closed]"