You all right! first problem fixed.
What do you think about second problem? loss results
Now when i run script i have result only few queries.
"C:\Program Files\nodejs\node.exe" run4.js
1
2
3
1 result = 200
1 latency: 111ms
4
2 result = 200
2 latency: 95ms
5
3 result = 200
3 latency: 99ms
6
4 result = 200
4 latency: 109ms
7
5 result = 200
5 latency: 105ms
8
9
10
Process finished with exit code 0
On Thursday, March 26, 2015 at 10:04:07 PM UTC+3, Viktor Sidorenko wrote:
>
> Hello all.
> I'm create simple client for burst check web server:
> var http = require("http");
>
> var req_total = 10,
> req_per_sec = 30,
> i = 0;
>
> var intervalID = setInterval(function timerik() {
> i++;
> console.log(i); //write to console task number
> console.time(i + ' latency');
>
> if(i == req_total){
> clearInterval(intervalID); //end of Life
> }
>
> http.get("http://www.yandex.ru", function (response){
> console.log(i +" result = " + response.statusCode); //write to
> console task number and statusCode
> console.timeEnd(i +' latency'); //write to console operation timeout
> });
>
> }, 1000/req_per_sec);
>
> Result:
> "C:\Program Files\nodejs\node.exe" run4.js
> 1
> 2
> 3
> 3 result = 200
> 3 latency: 24ms
> 4
> 4 result = 200
> 4 latency: 11ms
> 4 result = 200
> 4 latency: 43ms
> 5
> 6
> 6 result = 200
> 6 latency: 12ms
> 7
> 7 result = 200
> 7 latency: 8ms
> 8
> 9
> 10
>
> Process finished with exit code 0
>
> In this try i have two problems:
> 1) I lose few queries, In result you can see only 5 of 10 queries.
> 2) Few queries have not valid id. You can see them in result line 4.
>
> How i can fix this problems?
>
>
>
--
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 [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/nodejs/b550b1b0-4ca8-490f-8f0d-6a60af4d8bc6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.