Hacker News new | past | comments | ask | show | jobs | submit login

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.

I wonder how easy this is to do in apache.




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.




Consider applying for YC's W25 batch! Applications are open till Nov 12.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: