syzztem
syzztem

Reputation: 92

Why is writing a file using Splice slower when done asynchronously?

I'm trying to make a program to write files efficiently from data received in a socket.

My approach here is to use the splice Linux syscall, so I made a quick program to do this, and then I tried making the task asynchrnous. Here's what I do:

Synchronous:

Asynchronous:

I tried setting thread affinity, with no noticeable difference (Because both threads use system time and not CPU time maybe?)

How can this be slower, while also using 2 times more resources? Also, can the asynchronous approach be faster than the synchronous one if doing optimizations?

Upvotes: 0

Views: 53

Answers (0)

Related Questions