| ▲ | Asmod4n 3 hours ago |
| I found out that using mmap and just telling uring to read form there to beat anything else. |
|
| ▲ | megagpt1 3 hours ago | parent | next [-] |
| Databases vendors usually find that read outperforms mmap. Mmap being fast is a myth. |
| |
| ▲ | Asmod4n 28 minutes ago | parent | next [-] | | Tried every way to get contents of a file as fast to a client socket as possible. mmap and io_uring_prep_send were faster than everything else, no matter the size as long as you keep the map around for the lifetime of the process. for one off sends when a file is smaller than 256kb then io_uring_prep_read + prep_send are faster than everything else. | |
| ▲ | yxhuvud an hour ago | parent | prev [-] | | Note that grandparent actually didn't say they used mmap to actually get the memory, just mapping it. |
|
|
| ▲ | marginalia_nu 3 hours ago | parent | prev | next [-] |
| Depends a lot on the memory pressure. If you can be fairly certain the data is (or will be) resident in memory, mmap is basically unbeatable. If you can't (because the data is larger than RAM or there's other stuff competing for RAM), mmap can have gnarly system-wide performance implications[1]. [1] Mandatory mmap=poop-emoji link: https://db.cs.cmu.edu/mmap-cidr2022/ |
| |
| ▲ | Asmod4n 2 hours ago | parent [-] | | In my case: its a PROT_READ, MAP_PRIVAT map and i cannot get a SIGBUS since i tell the kernel to handle it all for me, thanks to liburing, instead i get a short send in that case. |
|
|
| ▲ | 0c3ca83 3 hours ago | parent | prev [-] |
| Why would you use uring to read from an mmap? Couldn't you just memcpy? |
| |
| ▲ | Asmod4n 3 hours ago | parent | next [-] | | To be more precise: i use that map to send assets out directly to clients from a zip file. Its a new web server i am building and its the fastest way i could find out. Just switching from epoll to liburing made the server ~45% faster too, its ridiculous. It can serve 10 gigabyte per second with a single thread, or around 10 million responses per second with h2 and 32 multiplexed requests. I had to write a new http load generator for that since i couldn't find one which could generate enough load to saturate my server or be fast enough to withstand it. | |
| ▲ | jeffbee 3 hours ago | parent | prev [-] | | Maybe they meant using IORING_OP_MADVISE with MADV_WILLNEED to bring ranges into memory? | | |
|