Giter VIP home page Giter VIP logo

Comments (8)

quininer avatar quininer commented on June 1, 2024

Thanks, I didn't use any io_uring specific tricks, I created this exmaple to compare with ritsu.

I don't use poll before accept, but use poll before readv, in order to better share buffer; I use readv and writev because they work in stable kernel; I did not use fixed opcode and IOSQE_IO_LINK.

from io-uring.

CarterLi avatar CarterLi commented on June 1, 2024

Thanks, I didn't use any io_uring specific tricks, I created this exmaple to compare with ritsu .

I don't use poll before accept, but use poll before readv, in order to better share buffer; I use readv and writev because they work in stable kernel; I did not use fixed opcode and IOSQE_IO_LINK.

So nothing special

in order to better share buffer

Well I don't agree with the idea you specified in the comment. Although you have polled before readv, multiple readv operations can still be run in parallel, only the readv becomes very short, short doesn't mean that it doesn't need time to run.

我不同意那个帖的观点。就算你在readv之前先poll了一把,多个readv仍然可以并发执行。先poll一把只意味着readv不会阻塞,但非阻塞操作执行仍然需要时间。

你想,磁盘I/O是不需要poll的,但是对于io_uring来说磁盘I/O仍然是并发执行的,设计就是如此。

Even so, the grouped two operations readv and writev are not atomic, you can't expect writev is run before other readv is run for the same buffer.

退一步说,就算在poll之后readv是原子性的,但是readvwritev这两个操作加起来肯定不是原子性的。你不能假设在前一个readv执行之后就不会有别的readv操作插进来。所以这个缓冲区还是有可能被其他readv覆盖掉

from io-uring.

quininer avatar quininer commented on June 1, 2024

You misunderstood what he means. Actually we have a buffer pool, and we only take the buffer from pool after fd is ready.

Looking at ritsu's high-level code may be clearer.

see https://github.com/quininer/ritsu/blob/master/examples/tcp_echo.rs#L30

from io-uring.

CarterLi avatar CarterLi commented on June 1, 2024

所以你是在poll之后选择一个空闲的buffer用是吧

from io-uring.

quininer avatar quininer commented on June 1, 2024

Yes.

from io-uring.

CarterLi avatar CarterLi commented on June 1, 2024

我的代码,甚至用了 fixed_files & fixed_buffers,有时候运行起来也没你的代码快 😭

https://github.com/CarterLi/io_uring-echo-server/blob/switch/io_uring_echo_server.c#L122

我怀疑是不是 liburing 本身有性能瓶颈。。。

from io-uring.

quininer avatar quininer commented on June 1, 2024

我們在 matrix 私聊吧。

from io-uring.

CarterLi avatar CarterLi commented on June 1, 2024

ok

from io-uring.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.