lwip-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [lwip-devel] Query on Per-socket Locking and Optimal Performance Mod


From: Simon Goldschmidt
Subject: Re: [lwip-devel] Query on Per-socket Locking and Optimal Performance Model in lwIP
Date: Tue, 5 Mar 2024 21:14:26 +0100
User-agent: Mozilla Thunderbird



On 05.03.2024 06:29, 袁仲 wrote:
Dear lwIP Community, I hope this message finds you well.

Yes, it found me twice. I wonder why you sent it twice?


I am Heavy, and I have been working on a user-space network component
built upon the lwIP library version 2.1.3-stable.In
<http://2.1.3-stable.in/> my recent project experiences, it appears that
lwIP(both version 2.1.13 and 2.2.0) does not inherently support
per-socket locking. To address synchronization issues, I've resorted to
using either the core tcpip lock provided by lwIP or creating custom
mutexes to safeguard against concurrent access to both the lwIP stack
operations and individual socket manipulations. This approach is
functional, but I anticipate potential performance degradation in
scenarios where multiple sockets are concurrently active, as these locks
are essentially global to all socket operations.
My question is twofold:
1. Does the current stable release of lwIP indeed lack native support
for per-socket locking mechanisms?

Are you talking about sockets or about pcbs? Because there should be no
problems using different sockets from different threads. You do have the
"only one thread in core lwIP" rule, so performance is not great on
multi-core systems in that case. That's the downside of staying
"lightweight" so far (the "lw" in lwIP).

2. What design pattern or model would best leverage lwIP's performance,
especially when handling multiple simultaneous socket interactions?

I don't think there has been public work in this area, so you're welcome
to provide anything if you come up with something. I could imagine
reader/writer locks, reference counting and many more. But up to now,
noone really had enough interest in this area to actually implement
this. I don't think it's a simple task to get that right!

Regards,
Simon



reply via email to

[Prev in Thread] Current Thread [Next in Thread]