Speed? Definitely, not great. My results (PHP vs. NodeJs) FirebirdSQL

355 views
Skip to first unread message

Franz Fortuny Loret de Mola

unread,
Sep 12, 2016, 6:40:48 PM9/12/16
to node-firebird
This is how long it takes to:
  1. Send request
  2. Execute query
  3. Receive data
  4. Send data to sever
This is the case using nodejs:

Then, exactly the same database, query, data, but using PHP to send the response:



As you can see, the combination php + firebirdSQL (Apache2, all SSL), was considerably faster than the NodeJs approach.


I need to say that my nodejs server does not compress the data, so the tool reports 35K data received for the PHP response and 175K for the nodejs response.


However, why is it taking so much longer in all of the following tasks?

  1. DNS Lookup (same site)
  2. Initial connection 174 vs 237
  3. SSL 90 vs 164
  4. Waiting PHP: 223.94 ms vs. Nodejs: 291.72 (PHP did compress, Nodejs, did not; query is identical).
  5. Content download: PHP: 87.34 ms vs. Nodejs: 221.39 ms almost 3 times longer
I need think about a reason for the fuss behind NodeJS. Perhaps if my server had 300 simultaneous connections, then I would see an advantage in NodeJS, where, maybe the increase in time would not be linear, as would be the case with PHP+Apache2+ssl.

It took two full days and half of their nights to figure out how to put this to work. Now I have a NodeJs server that connects seamlessly to my FirebirdSQL database, executes queries, (select, insert, update, delete) and gives back a decent response of the results. This is the part I like.

Look at the code in NodeJs:


pdo.sql can contain any sql statement without parameters.


The code is really nice, but there is no speed advantage whatsoever.


I think this is a valid test, since the only element that changes is precisely the middle software (PHP+Apache2+SSL+FirebirdSQL) vs (NodeJs+SSL+FirebirdSQL).


So, where do we go from here?





Reply all
Reply to author
Forward
0 new messages