How do you serve static files properly. #110
-
How would I go about serving static files such as images possibly with cache?. Is this safe to build a web application with uws? I also wanna say the performance on this is absolutely amazing. I will definitely be sharing my experience when finished. This is just super super fast, with just res.end('hey'), on an i7 laptop I'm able to get 1 million req's a second! off the BAT! Data. Stat │ 1% │ 2.5% │ 50% │ 97.5% │ Avg │ Stdev │ Min │ Req/Bytes counts sampled once per second. 6221k requests in 81.45s, 379 MB read I had to stress test this using 8 clusters all firing and producing equal results to the ones posted. The actual test used 100% cpu on a single core for the stress test alone, so I used 8 cores to stress the server resulting in 8 different results. The stress test was fired from a different machine. As you can see I hit 1 million req/s. I have basically gone from 250k req's to 1 million. wow. That's compared to nodes http server. Ooo and with only 25% cpu usage, compared to 100% from node. Also the only reason I am not able to max this cpu usage out is because to send that many requests maxed out the cpu on my desktop i7. When serving a file say an html file using nginx I am getting very similar results to uws using. This is what I come up with to test with uws..
Which is the same for both nginx and uws for serving a file. Which is pretty awesome. These are some big numbers for a dinky i7 laptop that's pretty old now. Sorry for the long post. Very appreciated. |
Beta Was this translation helpful? Give feedback.
Replies: 5 comments
-
There are examples such as VideoStreamer.js showing how to send potentially large files. Res.end is only for small responses |
Beta Was this translation helpful? Give feedback.
-
Hi Alex, can you quantify "small responses" please? |
Beta Was this translation helpful? Give feedback.
-
Less than big ;) |
Beta Was this translation helpful? Give feedback.
-
Less than something you would care about if it wound up as backpressure |
Beta Was this translation helpful? Give feedback.
-
So I guess up to 66.6KB is fine :o) But what about 666KB :-O |
Beta Was this translation helpful? Give feedback.
There are examples such as VideoStreamer.js showing how to send potentially large files. Res.end is only for small responses