Next.js: uWebSockets as HTTP interface

Created on 20 Feb 2017  路  4Comments  路  Source: vercel/next.js

According to https://github.com/uWebSockets/uWebSockets/issues/397#issuecomment-277237968, uws.http is considerably faster than http.


uWebSockets/blob/master/nodejs/http_sillybenchmark.js
uWebSockets/blob/master/nodejs/http.js

Performance is still very good as long as writeHead is not called in a hot path (this function is very slow). If you only res.end('some data here'); you get 230k requests per second.

from https://github.com/uWebSockets/uWebSockets/issues/397#issuecomment-275276648


Currently and only in v.0.13.0a6 (since a1). Near drop-in replacement for Next's use case? May need to be tested and benchmarked in a production environment.

Most helpful comment

master/server/index.js#L4

from

import http, { STATUS_CODES } from 'http'

to

import http, { STATUS_CODES } from 'uws.http'

It could indeed be a user choice, but if the benchmarks get confirmed, the transition is as seamless as it might appear (e.g.? https://github.com/uWebSockets/uWebSockets/issues/397#issuecomment-275332402), and it doesn't cause significant maintenance overhead, why not?

All 4 comments

Could you tell me where exactly you suggest to use this?

Anyway, since do support custom servers I hope this is doable in the userspace.

master/server/index.js#L4

from

import http, { STATUS_CODES } from 'http'

to

import http, { STATUS_CODES } from 'uws.http'

It could indeed be a user choice, but if the benchmarks get confirmed, the transition is as seamless as it might appear (e.g.? https://github.com/uWebSockets/uWebSockets/issues/397#issuecomment-275332402), and it doesn't cause significant maintenance overhead, why not?

v0.13.0 was released the other day. @arunoda Could you reopen the issue to allow for a thorough evaluation?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ghost picture ghost  路  3Comments

flybayer picture flybayer  路  3Comments

jesselee34 picture jesselee34  路  3Comments

irrigator picture irrigator  路  3Comments

havefive picture havefive  路  3Comments