wood burning stoves 2.0*
The moose likes Java in General and the fly likes Setting Throttle percentage in website Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Setting Throttle percentage in website " Watch "Setting Throttle percentage in website " New topic
Author

Setting Throttle percentage in website

Sunil Anna
Greenhorn

Joined: Apr 08, 2009
Posts: 7
I was not sure in which forum to place this question. So placed it in general java

I am working on a website. I've a requirement that says showing a newly added feature to a specidifed number of users.
Say 50%. So, if currently total userbase is 10,000 show this new feature to 5,000 people only. I want to achieve this programmatically.
How can I do that

I'm using
Java
Spring Web-Flow
and
Weblogic

Just a basic idea would suffice. Let me know if you need anyother info

Thanks
Sunil Anna
Greenhorn

Joined: Apr 08, 2009
Posts: 7
Trying my luck again

Lester Burnham
Rancher

Joined: Oct 14, 2008
Posts: 1337
Something like this may work:
Sunil Anna
Greenhorn

Joined: Apr 08, 2009
Posts: 7
Thanks Lester for your reply.

But what if I need to do the same for 27% or 35% users
userID certainly wouldn't work in this case.
Actually, I need to make this percentage configurable.
Jan Hoppmann
Ranch Hand

Joined: Jul 19, 2010
Posts: 142

Take the size of the whole userbase and check if the ID of the current user is in the first 27% (or 35%, or whatever you want). So only older users would be shown the new feature, of course. You could also check if the user ID is in the last n% (where n is your desired percentage). So only newer users would be able to use it. This is a quite simple approach, of course. I'm assuming you can't set a flag in the user itself.


Life is full of choices. Sometimes you make the good ones, and sometimes you have to kill all the witnesses.
Lester Burnham
Rancher

Joined: Oct 14, 2008
Posts: 1337
For N% you could use

if ((userID % 100) < N)

(assuming that userIDs are uniformly distributed, of course)
 
jQuery in Action, 2nd edition
 
subject: Setting Throttle percentage in website
 
Similar Threads
Is Java Web Start applicable for this?
Use of Java
eclipse 3.0.1 + javadoc URL
Security
Security