Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using native sendfile from OS for HttpServer #4351

Merged
merged 11 commits into from
Sep 1, 2024

Conversation

bas524
Copy link
Contributor

@bas524 bas524 commented Dec 16, 2023

This PR is motivated by #3368 and continuation of #4007

If OS has native implementation of sendfile function then it will be used (only for cmake projects).
Other projects (make and vcxporj) you can uncomment define POCO_HAVE_SENDFILE in Poco/Config.h

Note for emscripten sendfile will throw NotImplemented exception, because emscripten-core/emscripten#16234

Simple proof that this optimization is useful

Test without optimization

testFile:

OK (1 tests)

./Net-testrunner testFile  0.04s user 0.01s system 15% cpu 0.297 total

Test with optimization

testFile:

OK (1 tests)

./Net-testrunner testFile  0.03s user 0.01s system 5% cpu 0.842 total

15% vs 5%

add option POCO_USE_SENDFILE_FOR_HTTPSERVER, default - OFF
add test for HttpServer - testFile
add define fro Config.h POCO_USE_SENDFILE_FOR_HTTPSERVER
CMakeLists.txt Outdated Show resolved Hide resolved
detected macro POCO_HAVE_SENDFILE
replace types for sendFile with platform depended
wrap possibility of using sendFile with macro, if sendFile doesn't exist
in OS, then all methods don't exist
Net/src/SocketImpl.cpp Outdated Show resolved Hide resolved
@bas524
Copy link
Contributor Author

bas524 commented Jan 16, 2024

Hi, @obiltschnig !
May be You have any remarks?

@matejk matejk deleted the branch pocoproject:main April 15, 2024 11:20
@matejk matejk closed this Apr 15, 2024
@matejk matejk reopened this Apr 22, 2024
@matejk matejk changed the base branch from devel to main April 22, 2024 06:57
@matejk
Copy link
Contributor

matejk commented Jul 29, 2024

@bas524 , can you rebase on latest code on main branch, please?

@bas524
Copy link
Contributor Author

bas524 commented Jul 31, 2024

@bas524 , can you rebase on latest code on main branch, please?

Hi, ok. I'll do it this week

@matejk matejk removed the pending label Aug 1, 2024
Net/include/Poco/Net/SocketImpl.h Outdated Show resolved Hide resolved
@matejk matejk merged commit 710c2a4 into pocoproject:main Sep 1, 2024
43 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants