Closed ozgrakkurt closed 1 month ago
Being Send + Sync means that now you have two threads manipulating that data. If you pass ownership, than you can still pass it.
If you really want to be manipulating the same buffer in multiple threads, in the general case, that is unsafe. You can guarantee its safety by wrapping this in its own api, but that doesn't mean the general purpose api should be send + sync.
Being Send + Sync means that now you have two threads manipulating that data. If you pass ownership, than you can still pass it.
If you really want to be manipulating the same buffer in multiple threads, in the general case, that is unsafe. You can guarantee its safety by wrapping this in its own api, but that doesn't mean the general purpose api should be send + sync.
thank you 🙏
I take the ReadResult
copy into Vec<u8>
and send it over but this still causes a lot of page faults when copying because the ReadResult is huge. It would be nice to be able to send it directly and drop it in the other thread but doesn't seem like this will be easy to implement on glommio
side from what I understand.
Maybe I should just focus on getting my reads smaller 👍
This might be useful in a case like this:
If we copy 4MB of data, unless we are using pre-allocated huge pages in the application it causes massive amount of page faults and is a big bottleneck.