another zero downtime deployment solution

I wrote a post for jruby migration 2 monthes ago, it mentioned a solution to do zero downtime deployment: pull out server out of load balancers, restart server, and then put in the server. It works but has some cons

  1. you must have more than 1 app hosts.
  2. deployment process gets much slower if you have lots of app hosts.
  3. you lost one host's throughput during deployment.

I'm using a different solution for zero downtime deployment now, instead of processing app hosts one by one

  1. it starts replicated ruby instances...
read more

Posted in  deployment


another redis automatic failover solution for ruby

Redis gets more and more popular as a backend storage, so the redis failover solution becomes important before you use redis as a critical resource.

Currently the most popular automatic master/slave failover solution for ruby is redis_failover, it's based on ZooKeeper, if you already have ZooKeeper in your infrastructure, it's great.

But I noticed that redis already has a built-in automatic failover solution, called Redis Sentinel. In case you didn't heard of it, please read the official document, it's simple and no other external dependency. I searched on github...

read more

Posted in  ruby redis


newrelic-grape released

No instrumentation, no performance tuning!

This is my first time to use grape to build an api service, grape repo has more than 2k watchers, but I'm surprised there is no existing newrelic grape suppport, I just found some gists to do it, and this blog post gave me the idea to add newrelic instrument as grape middleware, but it's not the standard way newrelic recommends.

So I released newrelic-grape gem to help you integrate newrelic into grape.

What you need to do is

require "ne...
read more

Posted in  newrelic grape


How I find out a memory leak in grape

I'm helping my customer build a high performance api service these weeks, we are close to release, but when I did load test this Wednesday, I found the memory kept growing when I sent traffic and never went down, it was obviously a memory leak.

Lucky is I can reproduce the memory leak on my local machine, so I can detect it easily. Our api service is simple, only contains model layer (AR and redis) and api layer (based on grape). At first, I disabled model layer, but memory lea...

read more

Posted in  ruby


JRuby at OpenFeint - a JRuby migration success story

TL;DR: OpenFeint gets 40% performance improvement after migrating to JRuby from REE.

About OpenFeint

OpenFeint was the largest mobile social gaming platform in the world, It was acquired by GREE for $104 million last year, and a new global platform is building to replace OpenFeint. It is still one of the biggest rails applications, with hundreds of thousands API calls per minute.

OpenFeint platform is using rails 2.3.14 and was running on ree 1.8.7.

Why try JRuby

My main job is to improve the performance and scalability of OpenFeint platform. This April, I attended Railsc...

read more

Posted in  jruby


switch_user 0.9 released

switch_user provides a convenient way to switch current user that speeds up your development and reproduce user specified error on production.

Today switch_user gem 0.9.0 is released, all thanks to Luke Cowell.

He is a collaborator of switch_user gem, and did a great job for 0.9.0 gem.

  1. did lots of refactors.
  2. added unit tests.
  3. made switch_user a rails engine.

check out the changelog here.

I also updated switch_user example to use switch_user 0.9.0.

read more

Posted in  rubygems switch_user


zero downtime deployment

This is my new post on jrubytips. It teaches you how to achieve zero downtime deployment for jruby servers.

http://jrubytips.com/posts/5-zero-downtime-deployment

read more

Posted in  jrubytips


set proper value for CodeCache

This is my new post on jrubytips. It tells you the jvm CodeCache which may affect your server performance.

http://jrubytips.com/posts/4-set-proper-value-for-codecache

read more

Posted in  jrubytips


newrelic-rake released

4 months ago, I released newrelic-workling gem, which helps us montior the performance of background jobs. We used it to find out a GC performance issue. But we still have some cron jobs, who call rake tasks, running in the black box.

So I created a new project newrelic-rake that adds newrelic instrument for rake tasks. Now when I go to the newrelic, I can see the rake tasks listed in Background tasks section, it shows me the average execution time and call count for all rake tasks.

newrelic rake tasks

I can also see the performance breakdown for each rake...

read more

Posted in  newrelic rake


avoid using rubyzip

More precisely I want to say allocating as less objects as you can, rubyzip is just an example.

We have a background job compressing webui assets, uploading to S3, so mobile sdk can download assets to update webui dynamically.

After iphone5 and ios6 came to the market, we received much more webui req...

read more

Posted in  ruby performance


Fork me on GitHub