geoloqi.com MapAttack Server (or: How to make Ruby ROFLscale)MRI Ruby has a global interpreter lockBut MRI Ruby does not block on IOJRuby and Rubinius 2: Native ThreadsAnd it has a reactor pattern, just like Node JS!
geoloqi.com The Reactor Pattern “The reactor design pattern is a concurrent programming pattern for handling service requests delivered concurrently to a service handler by one or more inputs” - Wikipedia My simplest description: Takes your blocking IO operation, shoves it into its own kernel threadbehind the scenes, uses Unix kernel magic to make it rejoin the reactor queue when it’s ready. Linux: epoll(4) BSD: kqueue/kevent
geoloqi.comSinatra::Synchrony kyledrake.net/sinatra-synchronyImplements EventMachine with FibersThe result: NO CALLBACKS!< 100 LOCOnly coding change is to use EM libs and ﬁbersWOW, THAT WAS EASY.
geoloqi.comMake the relevant datastay outside of the slow persistence store.
geoloqi.comIf you’re trying to solve a problem by ROFLscaling your persistent store, you’re doing it wrong.
geoloqi.com Examples of doing it wrong “Let’s rewrite everything to use TrendDB” Using EC2 for a single-master DB “because it scales” Buying something from Oracle “Ruby/PHP/JS is too slow for this, let’s rewrite it inTrendLang” Most NoSQL solutions have dark secrets you don’tknow about. Global write locks, single write master, etcetera
geoloqi.comIf you must speed up your persistent store, here’s my practical advice.
geoloqi.com Real Hardware FTW? Single master database? Get a real server! Really! Cloud is only as fast as the fastest available HDD EBS performance is not great, even in RAID0 stripeSee orion.heroku.com/past/2009/7/29/io_performance_on_ebsand perfcap.blogspot.com/2011/03/understanding-and-using-amazon-ebs.htmland blog.dt.org/index.php/2010/06/amazon-ec2-io-performance-local-emphemeral-disks-vs-raid0-striped-ebs-volumes/and endevver.com/2010/03/cost-analysis-of-an-amazon-ec2-deployment.htmland mysqlperformanceblog.com/2011/02/21/death-match-ebs-versus-ssd-price-performance-and-qosand google.com/search?q=heroku+ebs+performance High end Xeon, 32GB ECC, fast 220GB SSD: ~$2K
geoloqi.com Real Hardware FTW?The paradigm is diversifying, and the reason is SSD.Say hello to the Fusion-io ioDrive Octal.PCIe x16 slot5.12TB6.0 GB/s read4.4 GB/s write1.19 MILLION IOPSCost: $100,000 (plus $10 S&H).It’s a steal at this price.. but it will get cheaper.