On Feb 18, 2015, at 1:34 PM, Anirban Bhattacharya <anirbanbhat...@gmail.com> wrote:Hi,
I am new to node. very new ..like infant.
Either I am doing something wrong or I understood everything wrong.
I wrote a node js simple JSON emitter which uses mysql module and query (select *) from a single table haviing 100 records and outputs on page as JSON (JSON.stringify..
I wrote a PHP page which also does the same thing from same table(Apache).
--
Job board: http://jobs.nodejs.org/
New group rules: https://gist.github.com/othiym23/9886289#file-moderation-policy-md
Old group rules: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
---
You received this message because you are subscribed to the Google Groups "nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nodejs+un...@googlegroups.com.
To post to this group, send email to nod...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/nodejs/b4db83d5-7fe9-4c5e-b87c-9c7c852a0e33%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
var http = require('http');var mysql = require('mysql');
var connection = mysql.createPool({
host : 'localhost',user : 'root',password: '########'
database: 'test'
});var strQuery = 'select * from prod_master';
http.createServer(function (req, res) {
connection.query( strQuery, function(err, rows){if(err) {
res.writeHead(502);return res.end();}res.writeHead(200, {'Content-Type': 'application/json'});res.end(JSON.stringify(rows));});}).listen(9615);Try to run siege (or ab or wrk) with concurrency > 1 ( say, 100)Also would be interesting to see performance difference of mysql2 module compared to mysql (I'm mysql2 author)
--
Job board: http://jobs.nodejs.org/
New group rules: https://gist.github.com/othiym23/9886289#file-moderation-policy-md
Old group rules: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
---
You received this message because you are subscribed to a topic in the Google Groups "nodejs" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/nodejs/mf0Qhj1WVl8/unsubscribe.
To unsubscribe from this group and all its topics, send an email to nodejs+un...@googlegroups.com.
To post to this group, send email to nod...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/nodejs/241EEB7E-3867-472D-A425-16CAC73BDDA1%40nbtsc.org.
--
Job board: http://jobs.nodejs.org/
New group rules: https://gist.github.com/othiym23/9886289#file-moderation-policy-md
Old group rules: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
---
You received this message because you are subscribed to the Google Groups "nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nodejs+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/nodejs/11bfd6e8-5ff7-4d55-bad2-c6eb037795d5%40googlegroups.com.
--
Job board: http://jobs.nodejs.org/
New group rules: https://gist.github.com/othiym23/9886289#file-moderation-policy-md
Old group rules: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
---
You received this message because you are subscribed to the Google Groups "nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nodejs+un...@googlegroups.com.
To post to this group, send email to nod...@googlegroups.com.
I am going to perform with 500 concurrent now with 1 sec delay for 10 mins and see if that makes difference.
--
Job board: http://jobs.nodejs.org/
New group rules: https://gist.github.com/othiym23/9886289#file-moderation-policy-md
Old group rules: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
---
You received this message because you are subscribed to a topic in the Google Groups "nodejs" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/nodejs/mf0Qhj1WVl8/unsubscribe.
To unsubscribe from this group and all its topics, send an email to nodejs+un...@googlegroups.com.
Seriously? A just select query is considered as so much db operation for a web app?
Ok tell me how to create test scenario ? A hello world will do?
--
Job board: http://jobs.nodejs.org/
New group rules: https://gist.github.com/othiym23/9886289#file-moderation-policy-md
Old group rules: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
---
You received this message because you are subscribed to a topic in the Google Groups "nodejs" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/nodejs/mf0Qhj1WVl8/unsubscribe.
To unsubscribe from this group and all its topics, send an email to nodejs+un...@googlegroups.com.
To post to this group, send email to nod...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/nodejs/ee2a074a-de62-4644-92eb-2d31891e5e8c%40googlegroups.com.
Seriously? A just select query is considered as so much db operation for a web app?
Ok tell me how to create test scenario ? A hello world will do?
--
Job board: http://jobs.nodejs.org/
New group rules: https://gist.github.com/othiym23/9886289#file-moderation-policy-md
Old group rules: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
---
You received this message because you are subscribed to a topic in the Google Groups "nodejs" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/nodejs/mf0Qhj1WVl8/unsubscribe.
To unsubscribe from this group and all its topics, send an email to nodejs+un...@googlegroups.com.
To post to this group, send email to nod...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/nodejs/CANjZ2S6te9qgp29-hfn3-ftT6R%2Bh20d7r_8WB6mopcKUfigMVg%40mail.gmail.com.
I must say indeed a realistic method than just let a tool decide. loved it.
To view this discussion on the web visit https://groups.google.com/d/msgid/nodejs/CAORXhGKdDQ3rvz9qV1m%3DaXRpJiRV3Jh8Fzyq0bBu_8fQ-HFGVA%40mail.gmail.com.
var http = require('http');
var mysql = require('mysql');
var connection = mysql.createConnection({
host : 'localhost',
user : 'root',
password: 'XXXXX',
database: 'test'
});
http.createServer(function (req, res) {
var strQuery = 'select * from prod_master';
connection.query( strQuery, function(err, rows){
res.writeHead(200, {'Content-Type': 'text/plain'});
res.end(JSON.stringify(rows));
});
}).listen(9615);Enter code here...<?php
mysql_connect("localhost","root","XXXXXX");
mysql_select_db("test");
$result=mysql_query("select * from prod_master");
$row = array();
while($r=mysql_fetch_assoc($result))
{
$row[] = $r;
}
echo json_encode($row);
?>
--
Job board: http://jobs.nodejs.org/
New group rules: https://gist.github.com/othiym23/9886289#file-moderation-policy-md
Old group rules: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
---
You received this message because you are subscribed to a topic in the Google Groups "nodejs" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/nodejs/mf0Qhj1WVl8/unsubscribe.
To unsubscribe from this group and all its topics, send an email to nodejs+un...@googlegroups.com.
To post to this group, send email to nod...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/nodejs/a9b0171a-8515-442b-b023-aaacf5025145%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
$data = json_encode($row,JSON_NUMERIC_CHECK);
header('Content-Length:'.strlen($data));
header("Content-Type:application/json");
echo ($data);
Here is Git link for source codes and database structure
--
Job board: http://jobs.nodejs.org/
New group rules: https://gist.github.com/othiym23/9886289#file-moderation-policy-md
Old group rules: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
---
You received this message because you are subscribed to the Google Groups "nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nodejs+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/nodejs/f272d221-954b-4aac-bcf6-fe3fb86f10a4%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/nodejs/CAPJ5V2aW_GBRUif%3Di6Hg6KyXXJP5AxBXgE51xsrdFWHf2JmDrA%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/nodejs/CAPJ5V2aW_GBRUif%3Di6Hg6KyXXJP5AxBXgE51xsrdFWHf2JmDrA%40mail.gmail.com.
However, comparing naive approaches with different utilities like these does have its warrant. Lets please not ignore that. Technically it may be apples vs. oranges but from a user perspective it is not. It is comparing how well you App does after you spend say an afternoon or weekend getting comfortable with either toolchain and doing your thing.