Good write up for a sensible solution to a problem which should effect lots of sites.
Personally, I would probably take the approach of settings a cookie per user. This would be very suitable when beta testing is enabled/decided by users, rather than a subset being chosen A/B style based on a value in the database. This would have the advantage that nginx would not have to make any database requests; just check a cookie on the request, likely speeding up the speed at which nginx handles requests. However, it would require some changes to the application (versus [small] changes to the database which the slug approach) to set the cookie etc.
Cheers. Yeah a cookie approach would be suitable for a lot of uses, including A/B testing. It's easy in Nginx/Lua:
local is_some_cookie_set = nginx.var.cookie_SomeCookie ~= nil;
Then you don't need Redis at all. For us though, we want to separate users by the URL and then a check at an application level variable, so I think this is the right approach still.
Personally, I would probably take the approach of settings a cookie per user. This would be very suitable when beta testing is enabled/decided by users, rather than a subset being chosen A/B style based on a value in the database. This would have the advantage that nginx would not have to make any database requests; just check a cookie on the request, likely speeding up the speed at which nginx handles requests. However, it would require some changes to the application (versus [small] changes to the database which the slug approach) to set the cookie etc.
I wonder how easy this is to do in apache.