Thursday, April 14, 2011

SharePoint Ratings: protests too much, methinks…

Jeremy Williams, Sr. Director, Modern Workplace

One of the new and cool features in SharePoint 2010 is the star-rating system.  For the uninitiated, the rating system is described here: http://office.microsoft.com/en-us/sharepoint-server-help/enable-users-to-rate-content-HA101791797.aspx (and as a cool find, here’s a way of surfacing rating in search: http://blogs.technet.com/b/speschka/archive/2009/10/28/using-the-new-sharepoint-2010-ratings-feature-in-search.aspx)  Alas, I digress; back to the issue at hand and (as usual) I’ll be using my Problem/Solution/Conclusion format.

Problem: When I click on my rating in SharePoint for a particular page, it tells me that it registered my rating and that it will take a little time for it to be added to the system.  No big deal, I’ll go grab some coffee… … …  Mmmm caffeine. Now that I’m back and much less cranky, I refresh the page and notice that my rating didn’t take.  Upon further investigation, I noticed (via Firebug) that SharePoint threw a HTTP 500 error when I clicked on my rating (thanks to Jonathan for finding that HTTP 500):

image

and the actual error message from SharePoint [The short story is that it’s throwing a HTTP 500 code]:

image 

So really, we have two problems: 1. My rating isn’t sticking nicely and 2. I’m getting HTTP 500 errors for some reason.

Solution, a pedantic trip indeed:

So couple of things; if I rate something, I have to wait the obligatory hour (on the hour) for the social service to run for my rating to take.  That being said, I went into our test site, rated a page and then kindly requested SharePoint run the rating timer job (UserProfileServiceApplication - Social Rating Synchronization Job).  After doing that, something interesting happened…The page knew that I had rated it a 4, but it wasn’t showing the stars of the average rating:

  • Before rating: clip_image001 
  • On hover:clip_image002
  • After hover: clip_image003

Now that seemed a bit weird; so I took another look at the timer jobs and decided to execute this one, also scheduled to run every hour on the half-hour: UserProfileServiceApplication - Social Data Maintenance Job.  After that ran I noticed no change and so I ran the Social Rating Sync Job again and Voila, I had my blasted rating shown:

clip_image004

So it would seem that SharePoint could take up to 90 minutes to display a user’s rating; and that it needs the Social Data Maintenance Job to run and then the Social Rating Sync Job to run.  

Conclusion (sorta-kinda-maybe):

So we answered one of our questions, which was My rating isn’t sticking nicely, Why?.  The answer is that the SharePoint timer jobs need to run.  SharePoint ships with extremely safe intervals for the necessary timer jobs (every hour).  However, depending on your environment and pervasiveness of ratings, you can bump these times significantly lower.  As with all things SharePoint, be sure to monitor SharePoint and SQL after you make these changes to make sure you’re not negatively impacting your farm’s performance.  Unless you have a very large user-base and lots of rating, you should be fine modifying these two jobs to run every 5 minutes, offset by 2 or 3 minutes from each other.

As for the HTTP 500 error code, I (unfortunately) don’t have an answer as to why that is occurring… SharePoint (well, Ratings) is doing all of the right things: it’s letting me rate something, noting my rating, aggregating my rating, and allowing me to change my rating; but each click brings a HTTP 500 error.  Go figure…  For now, I’ll chalk that HTTP 500 as “SharePoint expected behavior”, until of course, I find out otherwise…