Support » Plugins » Hacks » Running Calculations on a Large Number of WP Users

  • Hi everyone,
    This is probably a pretty high level question so I am hoping it gets moved to the WP-Advanced Forum, but with that being said, here is my issue.

    BACKGROUND

    I run a site with a large number of WordPress users (more than 4000 as of this writing). I would image that at our current rate of growth, we will reach more than 10,000 by the end of this year. The reason we have so many is that we allow our users to vote on submitted “essays” (WordPress Posts in a custom post type) and the three winners get a cash prize (every month). The way that I ensure that voting only occurs once per person per essay is by tying it to the WordPress user system.

    So, every month we get an influx of users who register to vote on the site.

    THE PROBLEM

    The problem is that I also run a script on each user that calculates a numeric “participation score” whenever they post in our Forums (Simple:Press wordpress plugin), comment on a regular blog post, author a post on the site (not submitted essay) or do some other miscellaneous stuff. When we had less than 500 users, the script did alright, but now that we have thousands, it takes a long time to run and uses a lot of resources. I need to calculate (using a custom function) the number of comments per users because this is not built into WordPress.

    We are on a dedicated server with 4Gbs of RAM and a quad core processor. This is not some small time shared server hosting. I also have w3 total cache installed and am serving static files from Amazon S3 CDN.

    I am looking for advice as to how to optimize this script so that I can get the information I need while not taking down the server. It doesn’t need to run real time, but if I can get an update once per day, that would be the minimum that I would want. I also want to have a solution that will grow with us if we get to 10K or 20K users.

    When the new score is calculated, that value is written to the Db so there is one Db write per user every time the script is run.

    Thanks, and if you need more information, let me know.

  • The topic ‘Running Calculations on a Large Number of WP Users’ is closed to new replies.