Greetings. There is a site in php. Suppose he has a lot of users, and the developers of the site need to roll out the new functionality only for a part of its users in order to test and compile feedback, fix errors and so on.

In the implementation, I see it this way: let's say 100,000 users on the site and I want to roll out the update only for the first 10,000, i.e. the algorithm is as follows: take the user id, if id> = 1 and id <= 10 000, then include a functional for it, if not, then the user does not see it accordingly. I think a bicycle to turn the code of a new functional into conditional blocks?

What do you think?

  • And then after testing you will forget to remove any one of these conditions and everything will be very bad :) Such things are usually made more cunning and not always at the source level of the site (in nginx, for example, there are also tools for A / B testing), but here I myself am rather poorly informed - andreymal
  • @andreymal I was thinking about that too :) - Amandi
  • Read about AB testing. For good, you should not have "php script users", but there should be one, as simple as possible, entry point that already decides what to show to whom. In particular, for random testing, enter a random number generator, for example, from 1 to 10, and give the new version to those who fell 3. - rjhdby

1 answer 1

If all users on the site are logged in - you can do it, but it may be that daily users who log in have an ID of more than 10,000. They will not see the functionality and users who get from 1 to 10,000, for example, rarely log in ... I think such a test does not effective will. You can create a separate table in the database, and everyone who logs in (no matter what ID) his ID is recorded in the Feedback table ... i.e. we make a request to the database if there is such an ID .. if there is no and no limit has been exceeded (10000 ) then write this ID to the database, if you already have an ID or limit is exceeded, just exit the request ...