History of massive-scale sorting experiments at Google
cloud.google.com
cloud.google.com
Note that this sort [in 2012] was 500 times larger than the
GraySort large-scale requirement and twice as fast in
throughput as the **current 2015** official GraySort winner.
(emphasis mine)1. As a programmer, you will feel most productive working on a project by yourself where you just pound out thousands of lines of code.
2. The secret to how you get 100x more done than any individual programmer can do is that you have 200 programmers working together feeling 50% productive.
3. Google has no interest in projects that can be accomplished by one brilliant engineer working by themselves.
It can be really unsatisfying for a programmer, because we all learn to program individually and that's what we base our "am I being productive?" feeling on, but it turns out that you can do some really amazing things if you're willing to put that aside and work together, even if it means spending half your day in meetings and checking email or writing design docs that no one reads.
And if you're feeling challenged, it's probably because you're doing something convoluted and even you won't remember how it works in six months and no one will be able to maintain it and you can actually get nearly equivalent performance out of three mapreduces and a drop-in machine learning model, so maybe you should just do that?
It's not for everyone, but at the end of the day would you rather feel productive and challenged, or actually change the world a little bit at a time?
Also, part of the point of a Google style interview is to keep pushing you to the point where your ability fails, then push in another direction to the point your ability fails. That way, they get an idea of the dimensions of your skillset. The vast majority of the people I recommended hiring didn't answer the questions perfectly.
Or, someone could not quite put enough thought into the integer encoding for Protocol Buffers. The encoding actually used is that the first bit of every byte is a flag for if there's a next byte, for a maximum of 10 bytes. The only advantage to this over encoding the length of the integer as the number of leading ones in the first byte (like UTF-8) is if they want the option to have the option later of a forward-compatible encoding for longer integer types, without just supporting multi-precision integers as byte arrays. If you slide all of those flag bits to the first byte, you don't have any more or any fewer flag bits, so it takes as much space, but you can use a jump table and the ability to use native 8-byte and 4-byte simple loads instead of many more masking operations and conditional branches. Giving up on anything longer than int64_t means that the maximum encoding length becomes 9 bytes instead of 10.
One day, the speed of the indexing system just dropped in half. It turns out that someone wrote a job that used machine learning to generate a bunch of regexes for some signal. They were recompiling the regexes for every page in the index. Google really needs most of their engineers that will naturally spot this kind of thing in code reviews, because if every engineer on the indexing team made a mistake like that once a year, the indexing system would always run at half speed, sometimes even 1/3 or 1/4 speed.
The indexing system uses as much electricity as a small town. The tiniest of improvements can mean thousands of dollars per year in savings.
Yes, but this has almost zero bearing on the actual interview. Being able to avoid this in real life means that you measure twice and cut once, you pay attention, and you ask for help and training. Being able to do something similar with dynamic programming or tree riddles in an interview has absolutely nothing to do with those longer-view skills.
> Google really needs most of their engineers that will naturally spot this kind of thing in code reviews, because if every engineer on the indexing team made a mistake like that once a year, the indexing system would always run at half speed, sometimes even 1/3 or 1/4 speed.
Again, this has nothing to do with puzzle interviews. In this case, you could hire smart people almost independently of whether they had encountered certain data structures before, and certainly without much concern about how fast they could spot things like this in an interview setting. And instead, hire for general aptitude, and then invest in training someone to be able to spot these things to the necessary degree.
Even though you can provide impressive-seeming examples of problems where minor tweaks in complexity or subtle implementation-specific points about data structures can result in huge problems, it's still not supportive of whiteboard-hazing style interviews that test more for interview aptitude than anything else.
After all, whoever it was that wrote the ML regex job, that person passed the interviews (and that person may have rightfully passed the interviews and deserved to work for Google, even after this later evidence that they weren't careful enough in one case).
I mean, heck, something like this? They interview multiple magnitudes of people necessary for this kind of job. I respect it as a hedge, but it probably also takes people out of the industry who could do more vital work someplace else.
I've met plenty of ex-Googlers who were great at reciting CS trivia, but actually not very good at real life engineering. Granted, that may be why they were ex-Googlers, but it still doesn't speak well of Google's hiring process.
But the whiteboard hazing produces too high a rate of false positives -- candidates who can recite CS trivia, study in a way tailored and overfitted to the interviews, and then pass them and be hired even if they don't actually have the broader skills that the interview was designed to conservatively filter for.
I speculate that new hires at Google aren't much better at anything than new hires anywhere else. They might become better later due to a compounding returns effect of already being at Google, but the hiring process didn't select them because they already were better. Instead, the hiring process is a status show, selectivity theater, to enhance the promotional reputation of a business-conquering nerds stereotype and to enhance Google's bargaining power by convincing people that they are only worthwhile to the extent they jump through interview hoops.
It's just luck.
I'm saying that they view the riddles, data structure hazing, etc., as tests for quality X (where X == careful engineer who won't inject N^2 complexity into something and make it take centuries).
But really, the puzzles and so forth do not select for that X. You get people who are good at the trivia, but who still otherwise would inject poor complexity. Meanwhile, you reject people who might be careful and pragmatic, but are not talented at the trivia.
From their perspective (since they believe it does test for X) it produces false positives.
I can't even begin to tell you how valuable I consider this approach to be...pushing (or leading) a candidate in every conceivable direction until failure is reached or limits are exposed...
HR professionals in almost any profession would benefit from implementing this technique to the extent that their resources allow...most don't have the luxury of time...
Example: As a member of a non-profit board I was once tasked with performing screening interviews for 5 candidates who were applying for a Camp Ranger position at one of the organization's youth camps...
I was not an HR expert then (or now), so I jotted down a few interview questions and scheduled interviews with the candidates...each one to begin at 8:00am at the site, and to last as long as it took...one per day...
I simply walked around the site, visited with the candidates, asked about their experience, and did everything I could to encourage them to "reveal" themselves...
I eliminated 2 candidates by around 10:00am, 2 more around 11:00am, and ended up driving to town for a burger lunch with the 5th...I later recommended the fifth...
He was hired, and ended up doing an incredible job...
I ended up giving other board members the impression that I knew what I was doing...at the time I most certainly did not...but I filed that lesson away...
I am convinced that a commitment to open-ended interview time, combined with "soft" skills probing, are critical if you want to properly evaluate candidates...
Fun facts: those are commonly known as "vbytes." They are the slowest kind of variable width integer encoding. The simplest (naive, and generally considered "wrong") implementations of variable-width-by-continuation-bits uses 10 bytes maximum. A proper implementation uses 9 bytes maximum.
There's actually no reason to ever use 10 bytes in this encoding. If you use 10 bytes, that means your last byte only holds one bit of actual user data. That's not very cool. But, your next-to-last byte holds seven bits of user data and one bit of metadata. We can easily say "if we're at the next to last byte, don't use metadata, just use all the bits we need." All you have to do is say "if we are currently at 9 bytes, don't use a 10th byte, just use this 9th byte directly." bam. Your 9th byte now has 8 bits of user data and you don't roll over a useless 10th byte with one bit of data.
The "slide all continuation bits into the first byte" sounds like a trick, but it's really using a TLV encoding where the first byte just holds a number between 1 and 8, so the entire integer+metadata is now [1 type byte][1 to 8 user data] = 2 to 9 bytes total. Using this scheme also kills any "1 byte, standalone, variable width integer" capability (unless you're storing partial values in the first T/L byte, but then that limits you to a much lower max value for one byte).
0xxxxxxS : 1 byte, 7 bits of data, -64 to 63
10xxxxxx xxxxxxxS : 2 bytes, 14 bits of data, -8192 to 8191
110xxxxx xxxxxxxx xxxxxxxS : 3 bytes, 21 bits of data, -(2^20) to 2^20 -1
1110xxxx xxxxxxxx xxxxxxxx xxxxxxxS : 4 bytes, 28 bits of data, -2^27 to 2^27-1
... and so on.
int64_t zigzag_decode(uint64_t in) {
/* Signed right-shift is implementation-defined behavior in C */
COMPILE_TIME_ASSERT( (1LL << 63) >> 63 == -1, compiler_uses_signed_arith_shift );
return (int64_t) ((((int64_t) in << 63 ) >> 63 ) ^ (in >> 1));
}
You can actually get slightly more dense packing using an encoding that doesn't have any non-canonical encodings by adding a length-dependent constant before the zigzag decoding step, but that's a bit more complicated to explain, and allows some 9 byte encoding values that won't fit in an int64_t.Or we can just store everything as int64_t natively anyway. It's only 8 bytes after all (and storage is big these days).
You can get the best of both worlds. The way to do it is: separate continuation bits (1's) from data bits with a 0. This gives identical encoding-length characteristics as what you are calling "vbytes" (1 byte can encode 0-127, 2 bytes can encode 128-16383, etc) while still front-loading the continuation bits.
These can also have the "avoid 10 bytes" optimization by just reading the next 8 bytes exactly if the first byte is just all ones (no need for a zero separator; it would be in the way and push out the final bit to its own isolated byte again).
But, it's largely guestimates anyway. It's hard to come up with good metrics of employee performance that correlate well to company performance and even harder to come up with interview questions that have good predictive power for those metrics.
Ideally, they'd relax the hiring criteria and all employees would start as 1-year or 2-year contractors. On-job performance is the best indicator of on-job performance.
I mention this instance largely because my friends at the big G tell me such a question is generally frowned upon, and not part of standard practice, (So I don't feel bad speaking openly about it) but more importantly it gives me a way to see how people can get a skewed perspective on a company given a... unique interview question when the overall guidance within the corp wouldn't align to asking that.
"Within the last 10 years" covers several generations of refinement to the interview process. I'd suggest forgetting about anything more than a couple of years old.
The major thing to keep in mind is that these days, your recruiter will ask you up front what subject areas you are strongest in, and you should expect to get interviews about those things.
There is a (surprising?) latitude given to interviewers to ask their own questions however, and the best advice I could give to interviewers and interviewees is that the question should really just be a seed to a good technical discussion.
Implementing a well known data structure is pretty far removed from `deep algorithms' and `high theory'.
I don't ask this to be dismissive, I just find this expectation that an RB tree is "well known" to be incongruous with the skill sets I've seen in a large number of thriving industry engineers in the roles that would have been relevant to me. (Thus my "high theory/deep algo" exemption statement, specialists who really have to get that deep I might expect to be familiar with something like this offhand) Broad knowledge about the algo, sure. To replicate the finer points of the implementation ad-hoc? I'm skeptical; and even if you can, the correct answer in most positions sans my exemptions would be "use a library", and as such I tend to prefer interviews that ask more relevant questions.
Keep in mind, this whole point was initially stated to contrast the RB tree question to many more "typical" interviews, and suggest that these outliers are just that, outliers; They certainly have been in my experience.
Yes, easily. The invariants are pretty simple. For extra fun, I'd try to enforce them via the type system. Though honestly, if you'd try to do red black trees in a language like Java or C++ you'd probably get a headache.
(Just follow Okasaki's simple approach there. See https://wiki.rice.edu/confluence/download/attachments/276121...
Functional languages make the typical Google / Facebook style interview much easier.)
> (Thus my "high theory/deep algo" exemption statement, specialists who really have to get that deep I might expect to be familiar with something like this offhand)
I guess my perspective is tainted there. I know some things about algorithms and datastructures, but some people I admire as `specialists' know so much more.
It's a great place to work for all sorts of reasons. But working on cutting edge stuff, well, that requires that you be good at fighting on both meritocratic and political fronts. The majority of the people that came in the same acquisition as me left before their golden handcuff payouts finished, because of this.
The remaining problems are indeed weird, and succumb only after application of every available tool: "asking around", CS theory, low-level debugging, visualization, heavy logs analysis, pouring over source code, strolling aimlessly, mining commit history, politicking, brainstorming...
Apache Spark completed a 1PB sort on 190 EC2 (i2.8xlarge) instances in 234 mins. Google did their 2011 1PB sort on 8000 computers in 33 minutes.
Moore's law is at work here and the results aren't very comparable but it would be interesting to see a head-to-head test on similarly speced clusters.
[1] https://databricks.com/blog/2014/10/10/spark-petabyte-sort.h...
Fun ways in which internal Google tech makes its way to Google Cloud services.
We haven’t found a single use case for the problem as stated.
Impressive nonetheless.References
1. "Playing a Trick on Uncertainty" by Thomas Bruss, page 7 of http://www.emis.de/newsletter/newsletter50.pdf
2. "Tom Cover’s Number Guessing Game" by Robert Snapp, http://www.ibrarian.net/navon/paper/Tom_Cover_s_Number_Guess...
3. "Who discovered this number-guessing paradox?", https://math.stackexchange.com/questions/709984/who-discover...
Do anyone has a real world use case of global sorting other than top-k?
http://www.lanl.gov/projects/trinity/specifications.php
They're claiming 87.0 TB/min on an 80PB filesystem, relative to Google's 36.2 TB/min.
Even if it isn't, it's unreasonable to expect the world to stop spinning in the interim.
If a superintelligent AGI is born tomorrow, it might just establish itself as a singleton, prohibit other AGIs from exisiting, and then take an indefinite vacation. If that happens, we'll continue to work on seemingly mundane, non-important problems (such as this one) for humanity's foreseeable future.
Don't forget that Google owns DeepMind. If there was a way to divine who's closest to AGI at the present time, the answer would probably be them (even if arrival is ultimately far off).
So is working on antigravity, free energy, and backwards time travel, but people don't do that because they are no reasonable approaches we can try.
Glorifying "AI AI AI" is silly because — there are no approaches we can try. Sure, we can identify ten million images per second, but none of that involves the least bit of "thinking."
Get back to us when you have an algorithm for love and art and petrichor.
I'm not naive enough to think that it can be solved in a short time. I do think that it is worth it for a person to spend the rest of their life working on it. There is just nothing more exciting than AI in my opinion.
Just imagine the possibilities...
(At Trimble, we had fully autonomous tractor PoC in 2001)
"Deep" AI (self-directed / human-interactive) will take more time and effort, and can have (simulated) emotions if so programmed; the determinate is how to sell such as a viable product or service that doesn't freak people out too much or do something stupid like place untrustworthy systems in charge of live nuclear missiles.