mirror of
https://github.com/ninenines/cowboy.git
synced 2025-07-14 12:20:24 +00:00
Add a skeleton performance chapter to the guide
This commit is contained in:
parent
db0d6f8d25
commit
5e0be061bb
3 changed files with 32 additions and 1 deletions
|
@ -71,6 +71,8 @@ include::streams.asciidoc[Streams]
|
||||||
|
|
||||||
include::middlewares.asciidoc[Middlewares]
|
include::middlewares.asciidoc[Middlewares]
|
||||||
|
|
||||||
|
include::performance.asciidoc[Performance]
|
||||||
|
|
||||||
= Additional information
|
= Additional information
|
||||||
|
|
||||||
include::migrating_from_2.6.asciidoc[Migrating from Cowboy 2.6 to 2.7]
|
include::migrating_from_2.6.asciidoc[Migrating from Cowboy 2.6 to 2.7]
|
||||||
|
|
29
doc/src/guide/performance.asciidoc
Normal file
29
doc/src/guide/performance.asciidoc
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
[[performance]]
|
||||||
|
== Performance
|
||||||
|
|
||||||
|
This chapter describes the performance characteristics
|
||||||
|
of Cowboy and offers suggestions to get the most
|
||||||
|
performance out of your application.
|
||||||
|
|
||||||
|
=== One process per connection
|
||||||
|
|
||||||
|
The first version of Cowboy featured a single process
|
||||||
|
per connection, whereas the current version of Cowboy
|
||||||
|
features one process per connection plus one process
|
||||||
|
per request. This has a negative impact on performance,
|
||||||
|
but is necessary in order to provide a common interface
|
||||||
|
for both HTTP/1.1 and HTTP/2 (as well as future HTTP
|
||||||
|
versions).
|
||||||
|
|
||||||
|
It is still possible to use a single process per
|
||||||
|
connection, and avoid the creation of additional
|
||||||
|
processes for each request, by implementing a
|
||||||
|
stream handler to process the requests. This can
|
||||||
|
be done for all requests, or just for a single
|
||||||
|
endpoint depending on the application's needs.
|
||||||
|
|
||||||
|
Stream handlers provide an asynchronous interface
|
||||||
|
and must not block, so the implementation will
|
||||||
|
be very different from normal Cowboy handlers,
|
||||||
|
but the performance gains are important enough
|
||||||
|
to justify it in some cases.
|
|
@ -54,7 +54,7 @@ modified.
|
||||||
|
|
||||||
=== Built-in handlers
|
=== Built-in handlers
|
||||||
|
|
||||||
Cowboy comes with two handlers.
|
Cowboy comes with four handlers.
|
||||||
|
|
||||||
link:man:cowboy_stream_h(3)[cowboy_stream_h] is the default
|
link:man:cowboy_stream_h(3)[cowboy_stream_h] is the default
|
||||||
stream handler. It is the core of much of the functionality
|
stream handler. It is the core of much of the functionality
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue