I would think the speed you are seeing is limited by file read rate, which
is slower than net transfer rates.  Try sending it from a string.

On Thu, Jun 6, 2013 at 10:15 AM, Scott Miller <[email protected]>wrote:

> Hello,
> I was curious if anyone's experimented with how fast node.js and socket.ioare 
> capable of sending out data.
> I know there's benchmarks on number of connections and stuff like that but
> I'm talking for a single connection, maximum connection rate.
> Suspecting this would be very dependent on server hardware.
>
> I'm expirementing with creating a speedtest using Node.js through a
> websocket. Presently I'm able to achieve consitantly reach speeds of
> 100Mbps with random spikes into ~120Mbps range using fs.createReadStream
>  on a text file and sending the data to a browser.
>
> Has anyone else seen anything like this or know of something that perhaps
> would be faster?
>
> Here's my server code.  I've tried messing with the bufferSize up / down
> but it really didnt have any affect.
> I've also tried various browsers on a range of machines all with
> connections of 1Gbps.
>
> var io = require('socket.io').listen(81);
> var fs = require('fs');
>
> var readStream = fs.createReadStream("output.txt",
>                                          {'flags': 'r',
>                                           'encoding': 'binary',
>                                           'mode': 0666,
>                                           'bufferSize': 64 * 1024});
> io.sockets.on('connection', function (socket) {
>         readStream.on('data', function(data) {
>                 socket.send(data);
>         });
> });
>
>  --
> --
> Job Board: http://jobs.nodejs.org/
> Posting guidelines:
> 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 post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/nodejs?hl=en?hl=en
>
> ---
> 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].
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
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 post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

--- 
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].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to