Use buffer pool to avoid large buffer allocation for connections and responses #87
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
A trivial buffer pool is used to get rid of these buffer allocations:
Ocsigen_http_com
)Ocsigen_senders.File_content
Moreover, some care is taken to avoid allocation for the last chunk of a file when the remaining data doesn't match the buffer size.
The changes are minimal, but reviews are appreciated. In particular:
Ocsigen_server
; it's literally 3 lines, but it's quite big conceptuallyOverall, these changes deliver up to ~25-30% more speed in some requests.
Performance
Effect of buffer pools
(buffer pool disabled with OCSIGEN_DISABLE_BUFFER_POOL -> enabled)
o=150 is the GC setting used in half of the runs
Effect of last-chunk optimization when serving files
Overall effect of
Lwt_chan
fix #49 + buffer pools + last-chunk optimization(only for files): compare figures at the top + those in POST to these for 2.6: