Spent the week re-writing memcached accessor & configuration for our java server to support clustering. Initiative of this project: Multiple memcached clusters are used in my project and some of them need to be accessed by multiple services written in different languages, one of which being PHP. The old accessor does not support clustering at all, not even to mention ketama consistent hashing (on the roadmap). While other services do utilize clustering for memcached, the java server accessor create one memcached client per host in the cluster and run a multi-write &/ multi-read. On top of that manual hashing was done to decide which cluster a particular key goes to (based on an additional parameter, for instance, user id) Old format: memcached.name=<cluster_name> memcached.hosts.0=<mc00, mc01> memcached.hosts.1=<mc02, mc03> To fully utilize clustering support from memcahed library, a new format was proposed: New format: accessor.<accessor_name...
In the past week I've been working on mainly one thing: migrating our existing repositories from bitbucket to github. Git is the first source control tool I used and has become dominant over the past few years. To be honest I'm surprised to see my project uses mercurial. The task of migration is fairly simple: fast-export will do the heavy lifting for you. Here 's an article on how to do it. The reason why it took me a lot of time is: my new project has baked a lot of secrets / keys inside source code and now it's going to be more public than only accessible by my group. After I started digging into these secrets, I've discovered more issues: - configuration management and secret management are done with the same configuration file - configuration and source code is not a perfect 1:1 map. With a lot of copy-paste, many sections of configuration are not even being used in code - deployment is a mess. some repos have dedicated (...
My primary focus during the past week is improve the performance of event handling system on the java server. Context: We use one thread for processing room transaction related user actions. For instance, user move from one room to another. I added instrumentation for profiling data a few weeks ago and noticed that user disconnect is taking a long time to process while other transactions on the thread is usually done with 5ms. I added timer for sections of code that processes such even and ran profiling on production this week, and the result is astonishing. The majority of the time was spent on a synchronized block. In short, we kick off a call to update database on a different thread and move on with the current thread, and the next thing current thread does is to synchronize on user object. Unfortunately the database updater job locks the user object as well so essentially we're doing the database update on the same thread. And the worst thing is, the lock in database upd...
Comments
Post a Comment