-
Notifications
You must be signed in to change notification settings - Fork 367
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Extending InMemoryConnectionStore to add DTLS connection sharing between instances #2118
Comments
Do these device use DTLS CID? Otherwise I don't see, how that works.
Let me say:
Do you have already numbers for that slowdown?
Would it be possible for you consider to use
Well, once it's clear, that |
============================================================
============================================================ Please note, there is a very fundamental difference between the |
Thank you a lot for taking time to answer.
Yes.
I fully understand and can't disagree. We just have some specific use cases, constraints and environment which lead us to evaluate alternative solutions.
I agree. We also manage other types of connectivity and we face similar challenges. We use firewall protection and in-memory rate limiting to mitigate the risks. Regarding DTLS callflows, don't we face the same (D)DoS risks with abbreviated handshake and shared
Not for now, but when we will have some, I will share it here.
Thanks, we did miss this class ! We will use it.
That is a valuable information for us.
Otherwise, our job would be much more boring 😉 |
You're welcome.
I may be wrong, but this smells for me more like adding availability than performance. If so, that's a different, maybe less complicated, challenge.
In my opinion the risk is very different. The DTLS Session is created once and the reused "unchanged". Therefore a DTLS Session maybe shared ahead, which then doesn't require a "remote request for a received handshake message". Even if that "weak consistency" (it's not granted, that the DTLS Session is really shared at that time) fails, the server will just fallback to a full-handshake. If that happens only very rare, it would not harm. The DTLS Context is split in two parts, the read/write keys (they don't change without (resumption-) handshake), and the "record sequence number" mechanism, which changes on every received or sent record. Additional the Exactly that "record sequence number" is the major trouble point. I assume, for many this is not "that serious" and for a good reason ("the ultimate available an scaling server") the convince themself to know, how to deal with it. Let's see, what happens ;-). |
Any progress? |
We did a Redis-based implementation and our functional tests are OK with current API. |
Thanks! |
Just to mention, maybe it helps: Californium has a user-space simple NAT. I use this frequently to test network issues caused by address changes, also under load. And Californium has a "benchmark-client" in cf-extplugtest-client. I use this to test "handovers" or "failovers" under load. The critical points in your approach will be, when the real communication changes faster than you align the states. Or on breakdown, when the real communication is ahead of the state wrote to the cache. I guess, both tools maybe useful for tests. |
Do you have any news about that ☝️ |
Regarding performances, we did 2 kinds of tests:
|
Thanks for the update!
Depending on the other middlewares, that's also my experience.
OK. AFAIK, (but I may be wrong) redis is TCP based? |
Yes, Redis is TCP based.
For now we use a simple 'direct' implementation. Indeed the delayed bulk mechanism would increase performance in this context, we'll keep that in mind if we encounter performance issue in the future ! |
Thanks a lot for the very interesting and useful update about the achieved performance! |
@cyril2maq do you consider to share the code ? (not specially as a Scandium contribution as I think this is maybe out of scope) |
No problem to share, but what kind of sharing ?
|
I was thinking about sharing the code as copy/past of the class or a link to public repository which contains it but I had in mind that this was "just" a |
You are right, this is not just a "RedisConnectionStore"; it is more a "InMemoryWithRedisFallbackConnectionStore" :
This is this updating part which is costly; and 90% useless (if you use a sticky proxy) as we will not read the result from redis because it will already be in memory of the instance. Hence @boaks suggestion to store it in redis with a bulk/delayed mechanism (and only write once even if a cid had several updates during this delayed period). |
;-(. Maybe you write me an e-mail and I write you my opinion back. |
We face the same needs as described in #1484.
Some of our clients does not enforce new handshake when their devices wake up; despite their IP address may have change - our LoadBalancer is IP-based.
We did analyze the DTLS CID LoadBalancer solution, but it does not fit our needs : we do not use kubernetes (for the auto-discovery), the persistency mechanism is sensitive to non-graceful shutdown; even with the BLUE/GREEN mechanism there will be some 'miss', and it is not compliant with auto-scaling (in case of decreasing the number of instances).
As a consequence we are implementing a redis-based connection store, which does answer to above limitations.
The idea is to extend the current InMemoryConnectionStore :
(in order to avoid several instances to keep a specific CID connection info in their local cache - hence inconsisent -, we also handle a 'clear in-memory cache for CID=xxx' event consumed by other instances when a connection is restored from redis on an instance)
This implementation requires quite few lines of code.
We are aware it will use intensively redis and decrease DTLS communication performances.
This solution does rely a lot on the current InMemoryConnectionStore implementation; nevertheless it only uses 'super.xxx' methods that are defined in the ResumptionSupportingConnectionStore interface.
We try to estimate if this approach is future proof - it is very sensitive to ResumptionSupportingConnectionStore interface / InMemoryConnectionStore implementation ; if there are some corner case where this could not work ?
Thanks a lot for any feedbacks 🙏
The text was updated successfully, but these errors were encountered: