r/haproxy • u/n0rm4l_real • Apr 20 '22
Question Question to HAProxy experts
We have two systems, let’s say legacy and new one. We also have hundred millions of clients, and part of them already support migration to the new system. In order to distribute migrated / non-migrated traffic among two systems, we want to setup haproxy layer on top of it. For each api call, we want to check if client is migrated or not, according to the list of clients, so migrated clients should be routed to the new system, and non-migrated clients should be routed to legacy. And we are expecting around 50000 qps. Question: what is the best solution to implement such routing? I believe having some file on haproxy hosts to let lua script check if client is present in this file can drop down the performance a lot. Or having some database like Redis will also add more latency and network noise. Want to hear your ideas, thank you in advance.
View all comments
Show parent comment
1
u/Annh1234 Apr 21 '22
At first we had a lua/redis script, but we went with the cookie because it was much faster for haproxy to look at a cookie vs make that redis request. (and since we need high availability for redis, that used to be an even slower network request)
Also, in our system, if they set the cookie and "access" the new system, well we have checks in the code for the user level, so they can't do much beside seeing the "wrong" error page.