Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7682097
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T18:29:20+00:00 2026-05-31T18:29:20+00:00

As I do not trust many benchmarks out there, because they are not actually

  • 0

As I do not trust many benchmarks out there, because they are not actually handling I/O like database connections, just sending “Hello World” to user and recieving enormous throughputs. I am not building any scalable things at the moment but plan to do soon. I need better results and make sure it’s realistic as much as possible.

I execute the following query at both scripts: “SELECT * FROM table” which returns 200 queries. The sample results are:

(Both MySQL, NodeJS anda Apache Servers are restarted before each test)

1000 requests, 100 concurrency:  Apache: 564.20 req/s   NodeJS: 102.61 req/s
1000 requests, 200 concurrency:  Apache: 393.75 req/s   NodeJS: 105.12 req/s
1000 requests, 400 concurrency:  Apache: 42.75 req/s    NodeJS: 105.07 req/s
1000 requests, 1000 concurrency  Apache: 16.5 req/s     NodeJS: 119.53 req/s

However, I do not trust these results, Because the query is always the same which is not likely in the real-time applications. How can I test the both suites myself? Would changing SQL query to an random insertion or random selection would help? Some caching in PHP-MySQL case helps if I do not restart the servers.

The code I used to bencmark:
NodeJS:

var mysql = require("mysql");
var os = require('os');
var MySQLPool = require("mysql-pool").MySQLPool;
var client = new MySQLPool({
  poolSize: 40,
  user:     'root',
  password: '123',
  database: 'test'
});

var express = require('express'), routes = require('./routes');
var app = module.exports = express.createServer();

app.get('/tables', function(req,res){
    client.query(
      'SELECT * FROM sample s',
      function selectCb(err, results, fields) {
        if (err) {
          throw err;
        }
        res.send(results);
      }
    );
});

var cluster = require("cluster");
if (cluster.isMaster) {
    for (var i = 0; i < os.cpus().length * 2; i++) {
        var worker = cluster.fork();
    }
} else {
    app.listen(3000);
}

PHP

$host = "localhost";
$username = "root";
$password = "123";
$db_name = "test";

$db=mysql_connect($host, $username, $password) or die('Could not connect');
mysql_select_db($db_name, $db) or die('no db');
$sth = mysql_query("SELECT * FROM sample s");
$rows = array();
while($r = mysql_fetch_assoc($sth)) {
    $rows[] = $r;
}
echo json_encode($rows);
?>

I know there are other approaches like Redis and Memcached to improve the performance, but I am interested in raw MySQL performance.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T18:29:22+00:00Added an answer on May 31, 2026 at 6:29 pm

    I’d recommend an insertion over any sort of selection — the former can’t be cached by nature, while the latter takes extra effort to prevent the same.

    It’s also worth timing a super-simple SELECT query. Replace “phoneinfo” with any table you have available;

    SELECT COUNT(anyFieldName) FROM phoneinfo WHERE 1 = -1;

    If you run both of those, and log the timing from 100+ rapid-fire page loads, then you should get a much better sense of what the comparison is.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We write apps for contract - we have many apps out there, and they
I'm working with some code (not mine I hasten to add, I don't trust
They say Cookies are bad . I personally believe there should be a "smarter"
UPDATE: The moral of the story is to trust a gut feeling and not
There have been many proposals to enhance the security of JSONP communications - some
I would like to ensure that a method (actually a constructor in my case)
I would like to know how many times an object has been autoreleased. I've
Not quite grasping what's going on here. Given the array (arr): [ { first_name:
Not sure if i'm naming it correctly (i.e. nested interface implementations). However I do
Not very sure how to word this question but I'll give an example. $string

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.