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

FreeBSD: Neither sendfile() nor select() triggers diskio #5

Open
Jille opened this issue Apr 15, 2012 · 2 comments
Open

FreeBSD: Neither sendfile() nor select() triggers diskio #5

Jille opened this issue Apr 15, 2012 · 2 comments
Assignees

Comments

@Jille
Copy link
Member

Jille commented Apr 15, 2012

sendfile() does not read from the disk and returns EBUSY when the data is not cached. Select() was supposed to flag it as ready when the data became available but it flags it as such even when the data is not yet buffered, so sendfile returns EBUSY.

There should be something that triggers the kernel to actually read from the disk, preferrably in a nonblocking fashion but otherwise in another thread.

@Jille
Copy link
Member Author

Jille commented Apr 15, 2012

Could you assign this to me?

@ghost ghost assigned Jille Apr 15, 2012
Jille added a commit to Jille/berthad that referenced this issue Apr 27, 2012
bwesterb added a commit that referenced this issue May 12, 2012
Thanks-to: Jille Timmersmans <[email protected]>

Signed-off-by: Bas Westerbaan <[email protected]>
@Jille
Copy link
Member Author

Jille commented May 13, 2012

I think removing the SF_NODISKIO flag to sendfile(2) does the trick. Because both the given fds are non-blocking it isn't supposed to block anyway. I think I misunderstand the flag to be "don't block on the disk" but I now think it reads "don't trigger reading from the disk".

Below are the stats while retreiving a large file which isn't cached with SF_NODISKIO and the workarounds removed.

[jille@deur2 ~/py-bertha/src]$ while :; do python main.py -H 192.168.253.4 -p 1337 stats; done
[...]
berthad_stats(n_cycle=16, n_GET_sent=0, n_PUT_received=0, n_conns_accepted=8, n_conns_active=1)
berthad_stats(n_cycle=18, n_GET_sent=0, n_PUT_received=0, n_conns_accepted=9, n_conns_active=1)
berthad_stats(n_cycle=106, n_GET_sent=5517312, n_PUT_received=0, n_conns_accepted=11, n_conns_active=2)
berthad_stats(n_cycle=361, n_GET_sent=20217856, n_PUT_received=0, n_conns_accepted=12, n_conns_active=2)
berthad_stats(n_cycle=478, n_GET_sent=26812416, n_PUT_received=0, n_conns_accepted=13, n_conns_active=2)
berthad_stats(n_cycle=734, n_GET_sent=41377792, n_PUT_received=0, n_conns_accepted=14, n_conns_active=2)
berthad_stats(n_cycle=929, n_GET_sent=52428800, n_PUT_received=0, n_conns_accepted=15, n_conns_active=1)
berthad_stats(n_cycle=931, n_GET_sent=52428800, n_PUT_received=0, n_conns_accepted=16, n_conns_active=1)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant