HNHacker News
TopNewBestAskShowJobs

igrigorik

5,399 karma · joined April 2, 2007

http://www.igvita.com/

[ my public key: https://keybase.io/igrigorik; my proof: https://keybase.io/igrigorik/sigs/eMcFb-lAFqkBGZKfdzJcQrC5a2dTBj_8cTAQqsXUhaE ]

submissionscomments
igrigorik··on Google acquires Postrank.com
Thanks Omar! Definitely couldn't have done it without all the support from the local community and friends - Waterloo is an awesome place.
igrigorik··on Google acquires Postrank.com
Thanks guys! Rest assured, I have no plans on retiring from keeping the blog going -- it's what got me here in the first place!
igrigorik··on Google acquires Postrank.com
In a nutshell: we aggregate user activity from dozens of social hubs, and use that data for analytics, benchmarking and so forth. So, if you think of links as "votes" as the core-data for Google's PageRank.. Than at PostRank we're extending that graph with dozens of other gestures: bookmarks, likes, comments, etc, and building our ranking on top of that! I'm sure you can imagine the myriad of ways of how that data can be applied in different contexts.

Super excited to join Google and take it to the next level!

igrigorik··on Google acquires Postrank.com
lol! No, apparently vimgolf just hit the limit on the free mongohq account. Upgraded - back to normal. Enjoy the golfing! ;D
igrigorik··on PostRank has been acquired by Google
Wooot! Kudos to our team, that's where all the credit lies.
igrigorik··on Your Chrome browser might not be using HTTP anymore
For those interested in playing with SPDY, ruby parser and generator: https://github.com/igrigorik/spdy
igrigorik··on Life beyond HTTP 1.1: Google’s SPDY
Disagree.. Having written both HTTP clients and servers, the SPDY spec is a breath of fresh air. Every packet has a predefined header length, and a clearly defined length for the trailing data - removes a heck of a lot of edge cases when implementing a parser.

Now if only TCP was message oriented... For that, I guess we have ZMQ.

igrigorik··on Life beyond HTTP 1.1: Google’s SPDY
Hmm, that's good catch - thanks. HTTP 1.0 didn't explicitly specify anything around persistent connections, so in practice you can add Keep-Alive header and hope that the server will respect it. By comparison, HTTP 1.1 defaults to persistent always and requires a "Connection: close" header to indicate otherwise.
igrigorik··on Life beyond HTTP 1.1: Google’s SPDY
SCTP addresses some of the same needs (primarily the multiplexing), but the major hurdle there is the fact that we're ditching TCP. As far as an upgrade path goes: it is much harder to get existing servers to support SCTP (think about Apache, Nginx, etc), then to bolt on support for a different application-level protocl (replace/augment HTTP with SPDY).
igrigorik··on Life beyond HTTP 1.1: Google’s SPDY
There are several proposed mechanisms to "enable" SPDY. The preferred is to run over SSL, and to use their NPN extension to negotiate SPDY support: http://tools.ietf.org/html/draft-agl-tls-nextprotoneg-00.htm...

Alternatively, there is work on sending an "upgrade" header in your regular HTTP response: http://code.google.com/p/chromium/issues/detail?id=69688

The NPN route is obviously the best in terms of performance, since the protocol can be negotiated as part of the TLS handshake..

Long story short: you can definitely run your own SPDY server and Chrome will auto-detect and use the protocol.

igrigorik··on Goliath: Non-blocking, Ruby 1.9 Web Server
--1.9 mode works really well under JRuby now - that was a big push within 1.6 and they've made a lot of progress. I'd call it "almost there".

Rubinius is a little bit further behind, but I've been able to run our Goliath stack on it, and that exercises quiet a few syntactic changes. So, I think both are close.

igrigorik··on Goliath: Non-blocking, Ruby 1.9 Web Server
That's a great question actually.. In any evented app, blocking your "reactor" is a big performance problem, since everyone will be waiting for you to complete that operation before anything else can happen. In general, you want to turn any CPU intensive work into an IO-bound operation, where the reactor is "waiting" for the IO notification that the computation is complete.

Now.. How you actually achieve that is a whole different story. You could, in theory, throw a job into some external work queue and poll that, or if your runtime permits, spawn some threadpool and periodically check that, or.. spawn a process and wait on that. In other words, it all depends on the actual operation.

In the case of PDF generation, if you rely on some external tool, you could use a mechanism like EM.system('shell cmd') to spawn a process and wait for it to return you the data.

igrigorik··on Goliath: Non-blocking, Ruby 1.9 Web Server
In all cases where we've deployed goliath, its running with a single thread. In theory, nothing stops you from creating a thread to do some background task (or EM.defer), but then you're on your own to make sure you have all the right synchronization logic.

As far as middleware goes, because you are reusing the same "app chain" between multiple requests, you just have to make sure that your middleware does not rely on any instance variables since those will get clobbered by other requests. Check the wiki page on middleware, we have a few examples around this.

Last but not least.. the EM reactor runs on a single core, so you're basically in the same deployment scenario as Thin or node.js. Having said that (always a caveat! ;)), Goliath can run on JRuby and Rubinius.. so in theory we have non-GILed environments there, which means we can start multiple reactors and run across multiple cores from within the same proc. This is not something I've experimented with in practice yet, but in theory its possible.

igrigorik··on Goliath: Non-blocking, Ruby 1.9 Web Server
evma_httpserver is definitely an alternative and one we used early on at PR. Having said that, we migrated away from it because it didn't provide us with the flexibility we needed to do keepalive, pipelining, etc - it basically provides just a very thin layer on top of an EM connection, hence the minimal API and functionality.

Thin would be an alternative to Goliath as well, although we chose to switch to a different parser and also to add the Fiber logic/wrappers right into the framework.

The way I think about it is: if Thin is an app server, then Goliath is more of a minimal framework which you can use to go from start to finish in if you need to bring up an API endpoint. That includes, configuration, routing if you need it, validation, etc.

igrigorik··on New Ruby 1.9 Features, Tips & Tricks
Speaking of named captures.. Something I didn't mention in the blog post, but a rather handy feature:

ruby-1.9.2-p136 :011 > /My name is (?<first>\w+) (?<last>\w+)/ =~ "My name is Ilya Grigorik"

ruby-1.9.2-p136 :012 > first

"Ilya"

ruby-1.9.2-p136 :013 > last

"Grigorik"

igrigorik··on PostRank plugin for Google Search
Heh, I hear ya. Let us take a crack at it.. can definitely do a better job of it!
igrigorik··on VimGolf.com - real Vim ninjas count every keystroke
Good news. You can now preview the solutions!

Only one wrinkle: you have to submit your own challenge to see the solutions.

Ex: http://vimgolf.com/challenges/4d1a8bf2b8cb3409320002c4

igrigorik··on VimGolf.com - real Vim ninjas count every keystroke
I'm logging the solutions, but in real MVP fashion... not showing them just yet. Need to bootstrap a vimscript parser first.

If anyone is up for it, would love some help with the client/parser: https://github.com/igrigorik/vimgolf

igrigorik··on Beyond Ruby: Mirah, Reia, Rite
That's a fair statement - it was a joke at RubyConf.. Quoting Matz actually. :-)
igrigorik··on Visual Guide to NoSQL
Please, no.. That visual is about as misleading as it gets. It is not about CA vs CP vs AP. In fact, even talking about it in those terms obscures the actual implications of the "CAP" theorem.

Short of going into a rant on the topic, please do check out: http://www.igvita.com/2010/06/24/weak-consistency-and-cap-im...

igrigorik··on Paul Buchheit: Serendipity finds you
That's an amazing story. Makes me wonder...

As the narrator says, this is not an usual pattern for people to migrate from one thing to next. And if that's the case, then chances are there are many many more people which may end up never finding "that calling". In a way, the above story illustrates the anti "pure hill-climbing" approach: the initial assumption/premise is that you should find a hill and then go really, really far in hopes of making a big contribution. Whereas Ed Witten's story shows that picking one single hill is not necessarily a good idea (local minima!) ... In fact, every once in a while (or systematically), you could jump to a different hill and still come out as a winner. Now the real puzzle is:

a) You could make the argument that your chances of finding the optimal hill for you, on the first try, are very slim. Hence, you should jump at least a few hills.. i.e, your real aptitude lies somewhere else.

b) Jumping too much will/may cause not enough time with anyone subject to make significant contribution - hence it's an optimization problem.

c) The "cross-discipline" question: its often acknowledged that bridging different knowledge areas is very helpful in terms of making interesting discoveries. Does that, in turn, mean that you should jump at least a few hills? If so, how many, and how much time?

Fun questions to ponder... Clearly there is no black and white answer either! Depends on your field, context, etc.

igrigorik··on Open Source Search with Lucene & Solr
Yep, take a look at loggly.com - AFAIK, a bunch of ex-Splunk guys. They're building their system on EC2 + SolrCloud.
igrigorik··on Multi-core, Threads & Message Passing
Great points. Based on feedback so far, I definitely realized that I should have used different terminology. Between "thread" as a software concept, and "thread" as context of an execution (at multiple abstraction levels, even), there is a lot of room for ambiguity.

As for conclusion, I think I'm going to have to make another go at it in another post.. :-)

igrigorik··on Experimenting with Node.js
Great stuff.

Just for sake of completeness, you can basically copy-paste that code into Ruby as well via em-websocket: http://github.com/igrigorik/em-websocket

Also, to avoid some of the callback muck that a few have brought up: http://github.com/igrigorik/em-synchrony

(same idea, closures + coroutines to abstract the callbacks).

igrigorik··on Async Rails 3 stack
Since this has come up a few times already: ab -c 5 -n 10 http://127.0.0.1:3000/widgets/http

That's not a benchmark, it's a proof of concept: http://github.com/igrigorik/async-rails/blob/master/app/cont...

/widgets/http makes an http request to /widgets, which does a 1s sleep query inside of mysql. All of this is happening on the same reactor loop, and finishes with ~2s, aka, the sleeps are not blocking the reactor and hence the "async stack".

igrigorik··on Rails Performance Needs an Overhaul
Yep, here's the async activerecord mysql driver: http://www.igvita.com/2010/04/15/non-blocking-activerecord-r...

It's a start.

igrigorik··on Rails Performance Needs an Overhaul
Agreed, that's a sweeping statement to make on Rails scalability. Just trying to make a point though. :-)

As for Goliath - we will. Time is the scarcest resource in a startup, and that's why haven't opened it up already. We need to get some documentation in place, and remove a few dependencies.

Point is though, there is nothing inherently novel in our stack! All off the shelf pieces: thin, async-rank, async middleware, em drivers + em-synchrony.

igrigorik··on Scalable Work Queues with Beanstalk
"From what's mentioned in the article, it sounds like some of the tasks that Beanstalk is being used for at PostRank are the same type of tasks that other companies, such as FlightCaster, are doing with Hadoop/Cascading."

Hmm, not at all. A message queue and a job queue are not necessarily one and the same. What we need is real-time scheduling, with up to the second resolution for each job. We don't run a batch "go fetch all of these pages" jobs, rather our system is always running, always fetching content. For that, a heap/work queue is required.

igrigorik··on High Concurrency MySQL @ Facebook #mysqlconf
Yep, just to provide some context / quick review of the talk:

It seems like the primary concern for Domas (presenter) is concurrency within InnoDB. Just to get it out of the way, he dismissed MyISAM, and went right into the low level optimizations & tweaks they're working on at Facebook. High level points are:

- they're using XFS, and he stressed understanding the block math and how it relates to your record sizes, etc.

- using "correct" scheduler has a big impact

- swappiness = 0, etc.

For InnoDB itself, it seems like they're carving out entire chunks of functionality that he claims "never worked correctly" anyway. For example, deadlock detection is something they disabled outright because it gave them a large perf boost. Likewise, for read-ahead functionality within InnoDB. Those were the two he went into a lot of details.

Concurrency + threads: there is no definitive formula, but he suggested setting thread concurrency to be the min concurrency of your lightweight requests (claimed: threads are cheap).

For ops / day-to-day, they focus on slow servers and dive right in: custom tools + gdb + freeze the server. They are playing with the idea of providing stored procedures interface to app developers since it'll avoid the round trip time between different queries (TBD). Also, they sometimes go very aggressive (timeouts of 3s, or even 1s), to force internal app devs to respect the DB layer.

Also hinted that they're using "smart caches" which are capable of buffering counters / updates and doing one update instead.

All in all, their biggest problems seems to be thousands of (app) servers that are always connected, hence the need for high concurrency...

(I'm sure I'm forgetting a whole lot, but that's off the top of my head)

igrigorik··on Toronto HN Meetup - Let's pick a date
Looking forward to the event!
← PreviousPage 6 of 7Next →