I’ve been working on retrofitting RedYawning and to share some of the changes I’ve made. They’re not live on the site yet, but they will be in a few weeks.
- Moved away from ID based URLs: the current URL scheme in RY was a hack of IDs and name based URLs (e.g. /user.aspx?userid=1 versus /users/hyperionab/user.aspx). I’ve encapsulated the URL generation logic and cut apart the old cruft. There are a bunch of broken URLs all over the site right now, which is a major reason I haven’t switched to the new code yet.
- Adding a Connection Manager: instead of having each ASPX page manage its own connections, I created a simple connection manager to the data store. Components can request connections and they have to put them back when they’re done. A thread cleans up connections that haven’t been let go and that are not executing. The connection manager also keeps track of how often connections have been used and the calling stack. It’s been super useful already since I’ve been able to find a couple of bad situations were there were connections being wasted.
- Reduce the number of exceptions: in the code, exceptions were being thrown everywhere, often caught then rethrown. A lot of the unavailability was due to this. So I’ve yanked a bunch out, threw in some extra logging in the cases where I want to keep track of Bad Things and now eat a bunch of exceptions thrown from the data store. Since most of the instances of the exception reaching the user were on writes, I’ve torn out exceptions all together on non-critical writes so the user will always be able to get to data.
Part 2 is going to be a lot of code clean up and data access optimizations. Stay tuned.