[nodejs] Re: http max performance experiments

2013-04-03 Thread billywhizz
ake core as fast and robust > as possible. > > Bruno > > On Tuesday, April 2, 2013 1:57:51 PM UTC+2, billywhizz wrote: >> >> just wanted to get some feedback on some experiments i have been doing in >> getting maximum http performance in node.js. the code is here: >

Re: [nodejs] http max performance experiments

2013-04-02 Thread billywhizz
thanks for the constructive feedback daniel. On Wednesday, April 3, 2013 12:39:23 AM UTC+1, dshaw wrote: > > I'm just going to leave this here: > https://vimeo.com/56402326 > > Daniel Shaw > @dshaw > > > On Tue, Apr 2, 2013 at 1:33 PM, billywhizz > > wro

Re: [nodejs] http max performance experiments

2013-04-02 Thread billywhizz
s: > > YEAH! HTTP/TCP doesn't belong in core! Move it all to user land! > > But in all seriousness, impressive stats, it just shows how much more > performance there is to gain in Node.js. > > On Tuesday, April 2, 2013 at 1:57 PM, billywhizz wrote: > > just wanted to g

[nodejs] Re: http max performance experiments

2013-04-02 Thread billywhizz
my simple static file server which has been added to the repo. On Tuesday, April 2, 2013 12:57:51 PM UTC+1, billywhizz wrote: > > just wanted to get some feedback on some experiments i have been doing in > getting maximum http performance in node.js. the code is here: > > htt

[nodejs] http max performance experiments

2013-04-02 Thread billywhizz
just wanted to get some feedback on some experiments i have been doing in getting maximum http performance in node.js. the code is here: https://github.com/billywhizz/minhttp this is a c++ addon that does the absolute minimum http processing and leaves all decisions to the end user about how

[nodejs] Re: Porting fs to the browser via browserify

2012-05-23 Thread billywhizz
+1 for emulating the low level bindings +1 for making this a project independent of but compatible with browserify On Tuesday, May 22, 2012 8:55:48 PM UTC+1, Adam Crabtree wrote: > > Browserify's pretty sweet. Not because of anything special that it's doing > to make it work (though there's plent

Re: [nodejs] When using Buffers, do the read methods also use the same initial Buffer heap memory?

2012-05-15 Thread billywhizz
the read methods are looking at the same memory. they just index into a v8 array that is wrapped around the raw memory buffer for convenience and speed of access. having said that, there are a lot of asserts and checks in the read* methods so i'd imagine they introduce quite a lot of overhead. a

Re: [nodejs] Re: How to avoid callback hell?

2012-04-16 Thread billywhizz
Axel, while nobody has explicitly stated that streamline.js is for everyone it seems that every time someone asks a question about control flow and nesting a streamline fanatic jumps on the thread and puts it forward as the solution to everything. Maybe you guys just don't realise how bloody an

[nodejs] Re: When threads_a_gogo beats node 2 to 1

2012-04-12 Thread billywhizz
are we just seeing the benefit of using 2 cores instead of 1? would be nice to also have the native node.js script in order to be able to run the benchmark... On Thursday, April 12, 2012 11:46:02 AM UTC+1, Jorge wrote: > > > > $ node bench.js > Threads_a_gogo J

[nodejs] Re: When fibers beat handwritten callbacks by 10 to 1

2012-04-12 Thread billywhizz
i also did a benchmark yesterday in response to the other thread which compares the overhead of streamline compared to just calling a native function back. it is 85 times slower on my setup, which means about 10% of every second will be lost in function overhead compared to native callbacks...

[nodejs] Re: When fibers beat handwritten callbacks by 10 to 1

2012-04-12 Thread billywhizz
the benchmark is completely skewed by forcing the use of process.nextTick. i've done up a better benchmark here and streamline is three times slower than native, even with fibers enabled: https://gist.github.com/2366955 On Wednesday, April 11, 2012 9:22:42 PM UTC+1, Bruno Jouhier wrote: > > ht

[nodejs] Re: Production Deployment Question

2012-04-03 Thread billywhizz
if these are all different services listening on different ports and doing different things then i don't think cluster or "up" will be much use to you. you should just be able to use the child_process bindings in node.js to spawn each of the separate processes from a master process and listen f

Re: [nodejs] Re: Node in 1 year?

2012-04-03 Thread billywhizz
his in the future, although i can see that it would be very difficult to achieve. more info on distruptor here: http://code.google.com/p/disruptor/ On Tuesday, April 3, 2012 5:40:52 PM UTC+1, Ben Noordhuis wrote: > > On Tue, Apr 3, 2012 at 18:30, billywhizz wrote: > > personal

[nodejs] Re: Node in 1 year?

2012-04-03 Thread billywhizz
personally i would like to see javascript get proper support for 64 bit numbers and would like to see node.js/v8 with better support for processing binary data. from the testing i have done, it's a major bottleneck when compared with c# or java. JSON.stringify/parse is still very slow for seri

Re: [nodejs] querystring.parse base64 encoded value - is this a bug?

2012-03-28 Thread billywhizz
ok. makes sense now. so i have to replace the base64 characters (-/=) in the string on the client side before i send it as part of the url... thanks for the help. > -- Job Board: http://jobs.nodejs.org/ Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines Y

Re: [nodejs] querystring.parse base64 encoded value - is this a bug?

2012-03-28 Thread billywhizz
thank matt, but i am still seeing unexpected behaviour. i've put a gist up here which shows the issue: https://gist.github.com/2233092 when i run the test using curl or a browser then i get the following result from url.parse, which is incorrect: { search: '?name=abc123+111', query: { name:

[nodejs] querystring.parse base64 encoded value - is this a bug?

2012-03-28 Thread billywhizz
i am passing a base64 encode sha1 digest in a query string but when i do a require("url").parse("/index?digest=QMEZSdNfGCPNMM+vyP1LqH8Efv4=") the returned query.digest has the + replaced with a space. this seems to be what is coded for in querystring.js ( https://github.com/joyent/node/blob/mas

[nodejs] Re: Is there any way to control the distribution of request to workers in cluster?

2012-03-22 Thread billywhizz
requests are not distributed - connections are. the operating system takes care of distributing connections across the pool of processes that are listening on the socket. this is handled internally by the kernel so in effect you have a layer 4 load balancer and there is no way of routing/proxyi

Re: [nodejs] node-inspector and v8

2012-03-22 Thread billywhizz
yes. +1 for node-inspector in core. it's a really useful tool and is a pain to have to install it separately... -- 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 t

[nodejs] stdout/stderr blocking

2012-03-21 Thread billywhizz
could anyone enlighten me on why writing to stdout and stderr now blocks? also, do we have a list somewhere of which methods in node.js block by default? to start the ball rolling: process.stdout.write (unless stdout is a pipe) process.stderr.write (unless stderr is a pipe) process.setgid proces

Re: [nodejs] Re: Can I get more accurate time than new Date()->getTime() in node.js

2012-03-05 Thread billywhizz
*applause* -- 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 nodejs@googlegroups.com To unsub

Re: [nodejs] Re: Secure distribution of NodeJS applications

2012-03-05 Thread billywhizz
oliver is correct. have had this argument many times. all you can ever do is make the source code difficult to get at and it's a question of how much effort you want to expend to do that. with something like v8, it's going to be difficult to even make it difficult as all someone will have to do

[nodejs] Re: Will Node.js work for me?

2012-03-05 Thread billywhizz
I would agree with what Mihai is recommending as the way to do this in node.js. You can also get node.js to talk fastcgi in a cluster behind nginx if that's what you want to do. the issues i think you will still have are: 1) how to prevent, detect and recover from infinite loops in the child p

[nodejs] Re: Buffer concatenation - why does it work?

2012-02-28 Thread billywhizz
s[j++].copy(bb, off); } return bb; } On Wednesday, February 29, 2012 1:43:33 AM UTC, mscdex wrote: > > On Feb 28, 7:32 pm, billywhizz wrote: > > ok. understood. anyone know the fastest way to concatenate multiple > > buffers into a single buffer? i need to concatenate m

[nodejs] Re: Buffer concatenation - why does it work?

2012-02-28 Thread billywhizz
Hi ben, i had a look at buffertools. it's very nice indeed. i will do some benchmarking of it against other methods when i get a chance. On Feb 29, 12:49 am, Ben Noordhuis wrote: > On Wed, Feb 29, 2012 at 01:32, billywhizz wrote: > > ok. understood. anyone know the fastest way

[nodejs] Re: Buffer concatenation - why does it work?

2012-02-28 Thread billywhizz
ok. understood. anyone know the fastest way to concatenate multiple buffers into a single buffer? i need to concatenate multiple binary buffers into one binary buffer when doing a file upload. the only way i can think of is to do the following: 1) as the buffers arrive in, push them into an array.

[nodejs] Re: Buffer concatenation - why does it work?

2012-02-28 Thread billywhizz
gt; > marcel@air ~ $ cat foo.js > var foo = {toString: function() { return 'foo' }}; > console.log(foo + foo); > > marcel@air ~ $ node foo.js > foofoo > > > > > > > > On Tue, Feb 28, 2012 at 1:56 PM, billywhizz wrote: > > from some initial test

[nodejs] Re: Buffer concatenation - why does it work?

2012-02-28 Thread billywhizz
from some initial tests, it seems 20 be about 30% faster to do s = a.toString + b.toString() instead of s = a + b On Feb 28, 11:41 pm, billywhizz wrote: > I'm struggling to understand why the following works when > concatenating two buffers into strings: > > var a = new B

[nodejs] Buffer concatenation - why does it work?

2012-02-28 Thread billywhizz
I'm struggling to understand why the following works when concatenating two buffers into strings: var a = new Buffer("0123456789"); var b = new Buffer("0123456789"); var s = a + b; console.log(s); is the addition operator overloaded in some way to coerce a buffer into a string when used with two

[nodejs] Re: equivalent to PHP's $_SERVER['SERVER_ADDR'] ?

2012-02-27 Thread billywhizz
r, but I don't understand how I can tell which interface is > the proper one. > > Thanks, > > > > > > > > > > On Mon, Feb 27, 2012 at 5:48 PM, Ben Noordhuis wrote: > > On Mon, Feb 27, 2012 at 23:25, billywhizz wrote: > > > as far as i know i

[nodejs] Re: equivalent to PHP's $_SERVER['SERVER_ADDR'] ?

2012-02-27 Thread billywhizz
as far as i know if you want to get the specific ip address of an interface then you will have to bind explicitly to that IP address and not to "0.0.0.0" in order to get the correct IP from getsockname, which is the system call used under the hood. so, instead of doing: server.listen(80) or server

[nodejs] Re: Secure distribution of NodeJS applications

2012-02-26 Thread billywhizz
if you put your js libs in the lib directory of the node.js source and run make, the libs will be included as natives in the compiled node binary. you can then just require them without a path. e.g. if you have a module named test.js in the lib dir, then just do the following: var test = require("

[nodejs] Re: Node as a CGI or FastCGI module

2012-02-17 Thread billywhizz
Jeremy, if you want to experiment, you can have a look at my various fastcgi experiments with node.js here: https://github.com/billywhizz/node-fastcgi-parser let me know if you run into any issues. has been a while since i looked at it. On Feb 17, 6:51 pm, Matt wrote: > I think it's b

[nodejs] Re: Node CPU use analysis

2012-02-16 Thread billywhizz
at: 1) simple and fast static file serving out of the box 2) reverse proxying for TCP and HTTP 3) fastcgi for talking to PHP or AN/Other FastCGI backend (see: https://github.com/billywhizz/node-fastcgi-parser) anyway - i'll post some more benchmarks up here when i get the chance and hopefully we c

[nodejs] Re: Node CPU use analysis

2012-02-15 Thread billywhizz
i don't hear anyone on this thread complaining that node.js is slower. we expect it to be slower and it probably always will be, although "always" is a dangerous word in computer science. my goal with this research is to get node.js to a point where it's fast enough that people have an option not t

[nodejs] Re: Node CPU use analysis

2012-02-14 Thread billywhizz
it tells me how long it takes to process the http headers. is just a baseline. i'll add tests for different file sizes. On Feb 15, 1:17 am, Mark Hahn wrote: > Why test a  0k file?  What could that possibly tell you? -- Job Board: http://jobs.nodejs.org/ Posting guidelines: https://github.com/j

[nodejs] Re: Node CPU use analysis

2012-02-14 Thread billywhizz
btw - with some tweaks i am able to get 47k rps from nginx on 85% of a single core (rest is IO wait). i am serving the 0k file from /tmp which is shared memory. have updated the nginx.conf in the gist. matt - you are way ahead at the moment!! ;) On Feb 15, 12:56 am, billywhizz wrote: >

[nodejs] Re: Node CPU use analysis

2012-02-14 Thread billywhizz
ation with no extra modules but there are probably tweaks that can be made to it. i'll download an build a later version of nginx when i get a chance. On Feb 15, 12:42 am, Matt wrote: > On Tue, Feb 14, 2012 at 7:00 PM, billywhizz wrote: > > Matt, there are all sorts of optimisations

[nodejs] Re: Node CPU use analysis

2012-02-14 Thread billywhizz
and like libuv is... On Feb 15, 12:03 am, Mark Hahn wrote: > > it would be able to spend most of it's time in c++ land serving static > > files so there is no reason it could not be as fast as nginx. > > That would only be true if you coded your c++ to be event-loop based like > nginx is. -- Jo

[nodejs] Re: Node CPU use analysis

2012-02-14 Thread billywhizz
Matt, there are all sorts of optimisations available. if you really want top performance, then you could write a c++ module that does static file serving and can be easily plugged into a node.js http server. it would be able to spend most of it's time in c++ land serving static files so there is no

[nodejs] Re: how to fetch some data using on tcp connection in my http server app's get function

2012-02-14 Thread billywhizz
wouldn't it be nice if the connection in both the http client and server were event emitters that emitted the request, close, upgrade and continue events? would make writing this kind of server, which seems to be a pretty common pattern, much simpler and more correct imho. On Feb 14, 11:53 am, msc

[nodejs] Re: Node CPU use analysis

2012-02-14 Thread billywhizz
,https://github.com/joyent/node/issues/1802 > > It entails a fairly significant revision to the net.Socket queue > mechanism. I don't know of anyone working on that. > > On Feb 13, 3:47 pm, billywhizz wrote: > > > > > > > > > from tests i have done using th

[nodejs] Re: Node CPU use analysis

2012-02-13 Thread billywhizz
from tests i have done using the low level node.js bindings and sendfile on linux (which requires a small patch to the node.js c++ source), node.js can get pretty close to nginx (within 10-20%) for serving static files. the larger the files, the smaller the difference as most of the work is then be

[nodejs] Re: RFH: Cross-platform binary modules

2012-02-11 Thread billywhizz
Nate - i'm not "against" npm so to speak. it just doesn't suit my requirements as i like to do my own builds on a build machine and roll everything out to the production machines i am using and have full control over where everything goes. npm takes too much control away from me and i am a control

[nodejs] Re: RFH: Cross-platform binary modules

2012-02-10 Thread billywhizz
, billywhizz wrote: > i tend to agree with Roman's sentiments. Whatever is used to build > addons should be included with the core node package and not be an > external module. node-waf worked really nice as far as i was > concerned. > > also, node-gyp has a ton of depend

[nodejs] Re: RFH: Cross-platform binary modules

2012-02-10 Thread billywhizz
i tend to agree with Roman's sentiments. Whatever is used to build addons should be included with the core node package and not be an external module. node-waf worked really nice as far as i was concerned. also, node-gyp has a ton of dependencies which means if i don't want to use npm (which i rea

[nodejs] Re: question about assert macro

2012-02-08 Thread billywhizz
On Feb 8, 4:13 pm, Ben Noordhuis wrote: > On Wed, Feb 8, 2012 at 16:44, billywhizz wrote: > > I'm confused about the usage of assert everywhere in the c++ bindings > > in the production release. shouldn't assert only be used in debug > > mode? > > Yes, and

[nodejs] Re: question about assert macro

2012-02-08 Thread billywhizz
also, if i define NDEBUG in node.h the assert doesn't happen and an EFAULT error is returned when attempting to write to the socket. this is on fedora12/64. On Feb 8, 3:44 pm, billywhizz wrote: > i've been tinkering with the node.js bindings directly and have come > across an iss

[nodejs] question about assert macro

2012-02-08 Thread billywhizz
i've been tinkering with the node.js bindings directly and have come across an issue where i get a fatal exception thrown on a tcp_wrap write operation when the buffer is not valid: node: ../src/stream_wrap.cc:293: static v8::Handle node::StreamWrap::Write(const v8::Arguments&): Assertion `Buffer:

[nodejs] Re: Embedding Node?

2012-02-07 Thread billywhizz
btw - i haven't tried this on windows but presume it works the same as below... On Feb 7, 11:15 am, billywhizz wrote: > if you look at the node.js file in the src directory you will see the > following: > >     if (NativeModule.exists('_third_party_main')) { >    

[nodejs] Re: Embedding Node?

2012-02-07 Thread billywhizz
if you look at the node.js file in the src directory you will see the following: if (NativeModule.exists('_third_party_main')) { // To allow people to extend Node in different ways, this hook allows // one to drop a file lib/_third_party_main.js into the build // directory wh

[nodejs] Re: Figuring out the latest green node.js build

2012-02-07 Thread billywhizz
as far as i know, the 0.6 branch is the current stable one. stable branches are always even numbers and unstables branches are odd. the latest stable release should be this one: https://github.com/joyent/node/zipball/v0.6.10 On Feb 7, 7:26 am, Ricky Ng-Adam wrote: > Hello! > > How do I find the