Live data from Hacker News

“What happens when you type Google.com into your browser and press enter?”

github.com

31–40 of 136 posts

Re: “What happens when you type Google.com into your browser and press enter?”

#31
So far, nobody has filled in the section on how a key-press event works its way through the OS, up to the window system, to the application, and to the code handling the input text box.

Then there's what's happening at the Google end. Before search personalization, popular queries ("google", "Britney Spears") were handled by caches the first Google machine you talked to, and never even reached the search engine. Since search personalization, there's some cookie traffic, and then your personal dossier is retrieved from storage at Google for use in interpreting your query.

Then, in the middle, your query probably travels through five to ten routers (try a traceroute) just to get to Google. Packets move from local Ethernet or WiFi to DSL to fiber to bigger fiber to gigabit Ethernet within a Google data center.

And where is "google.com" for you? That's hard to find out. For me, today, it's at "nuq04s19-in-f14.1e100.net", wherever that is. My connection routed from Silicon Valley to Santa Rosa to San Jose before reaching a Google point of presence at Equinix in San Jose.

Somebody also needs to talk about what's happening in the CPUs, with 3 billion or so instructions per CPU core every second, all devoted to looking up a cat video for you.

When you play a cat video, more computation occurs than was done in the history of the world prior to 1940.

Re: “What happens when you type Google.com into your browser and press enter?”

#32
post #20

I didn't know this was so popular of a question. I've been asking it for many years. I love it because anyone with expertise in any part of the system should be able to answer it. Are you a networking guru? If so, you should be able to talk a long time about the network bits. Are you a kernel guru? Same. Etc. It also gives me a good idea how broad the interviewee is. It is always amazing to me how many people fail th…

So, everyone fails and you think it is a good question? That doesn't make a lot of sense to me. I can't reasonably answer the question, because I haven't really needed to know it. When I need to know it, I'll learn it, and quickly. How is that question a good measure of me if you are not hiring me to architect a router or something where it pertains? I could ask you questions in my domain that you'd be hopeless at an…

The other thing the question tests for is rigidity of thinking.

You can answer the question - pick whatever part of the stack you're familiar with and explain what's going on there. If you're a web developer, talk about how the browser loads the HTML for the page, then pulls out the tags and fetches CSS for them, then executes any tags. It sees a tag, then an , and uses that to render the query box. If you type and that and hit submit, it loads the page in the 's action attribute.

If you're a desktop software guy, talk about how Windows dispatches a WM_KEYDOWN event, which the browser's event loop picks up. It then initiates an HTTP request and renders Windows controls for every HTML element on the page.

If you're a backend database guy, talk about how Google must run a query against a massively sharded database to look up the terms you just entered and fetch document URLs for each of them. It then merges the query results to AND your query terms together, and return them.

Note that all of these answers are completely wrong (and basically the only way I could know this is because I worked on Google Search and actually know how it works). Google.com inlines styles into a single tag; there are no stylesheets, because we found the latency of the HTTP request outweighs the cache savings. I know less about how Windows works, but I wouldn't be surprised if under Windows7 and .NET the Win32 API is an emulation layer, and I know that most of the elements in modern browsers have no OS analogue and are rendered in shadow DOM via the browsers own box-and-painting mechanism. And there are no databases involved in Google; the whole web is stored in RAM and queries are matched & scored against everything (this itself is an oversimplification, but I'm limited to public information in what I can disclose...)

It doesn't matter. The point of the question is to get you to reveal what you know. If you don't reveal anything, you fail. Most people, when faced with a problem that they don't know the answer to, shut up and don't do anything. For a lot of tech companies, you want to hire people who will move forward and do something, even if it's wrong, because you'll have more information to course correct with a wrong solution than with no solution.

Re: “What happens when you type Google.com into your browser and press enter?”

#33
post #5

Love it! One of my favourite bad interview questions. I got asked this in an interview ~5 years ago. My response was to look shocked... Pause. Then ask: "What do you mean? What detail do you need? DNS? SYN / ACK? HTTP?" At the point I started talking about syn/acks they just cut me off and moved on to the next question. Same company (different person) started the phone screen with 'oh so your CV says you know linux,…

I completely agree with your last statement and I would like to add that i think any question that can be answered by a 'single' google search provides absolutely no valuable information to the interview process.

I'm going to disagree with this only because it comes down to the intent of the interviewer. If they're looking for a boolean right/wrong answer then you're absolutely correct. Feel bad for the interviewer who asks such things thinking they're being clever (and believe me, I've suffered through those interviews).

Instead, if it's the starting point of a conversation then hell, bring Google into it. Use that topic to figure out if the candidate is someone who converses well, thinks well, googles well, bullshits well, ultimately is it someone your team would want to continue working with.

Contrast that approach to something like FizzBuzz, which really affords no avenues for interesting conversation and the difference becomes apparent.

Re: “What happens when you type Google.com into your browser and press enter?”

#34

>17.78 mA of this current is returned on either the D+ or D- pin (the middle 2) of the keyboard's USB connector. Oh, so we will look at it at THAT level of detail, nice. Then hardware interrupts, seems ok... Then HSTS and DNS, yeah, no, you are skipping like 3 more pages of things that happen in between. Good luck with your naive experiment.

Isn't that the point of having others help and fill in the gaps? What's the point of belittling it to a "naive experiment"?

Re: “What happens when you type Google.com into your browser and press enter?”

#35

Earlier quoted context omitted.

The parent clearly said "so many people" and not "everyone" - that's a really important difference! I really struggle to believe that a competent software developer would be unable to answer this question with some degree of accuracy. It's not like it's a networking question - it's fantastically open-ended and covers everything from hardware, operating systems, networking, GUIs... and that's useful flexibility. On to…

Context is important. My team is a web systems team. I wouldn't expect someone that has written flight software to know the answers. I would expect someone that is advertising themselves as a senior web developer or web systems guy to.

It's not about the specific answers - it's about being able to reasonably construct a model about how a system might work, based on the knowledge you do have, and clearly communicate that model (including its limitations!) to another engineer.

Sure, if you are a dedicated embedded device programmer who has never used a web browser or engaged in networking of any kind, then maybe you like unaccountably not be able to construct a compelling description of the process. But I find that unlikely; all I can suggest is that if you are hiring for such a position, then a similar question more tilted towards a particular field would be equally useful.

The overall idea of an open-ended question like this is sound.

Re: “What happens when you type Google.com into your browser and press enter?”

#36
post #20

Earlier quoted context omitted.

So, everyone fails and you think it is a good question? That doesn't make a lot of sense to me. I can't reasonably answer the question, because I haven't really needed to know it. When I need to know it, I'll learn it, and quickly. How is that question a good measure of me if you are not hiring me to architect a router or something where it pertains? I could ask you questions in my domain that you'd be hopeless at an…

The other thing the question tests for is rigidity of thinking. You can answer the question - pick whatever part of the stack you're familiar with and explain what's going on there. If you're a web developer, talk about how the browser loads the HTML for the page, then pulls out the tags and fetches CSS for them, then executes any tags. It sees a tag, then an , and uses that to render the query box. If you type and t…

Bingo, you're hired. When do you want to start? Er.

Re: “What happens when you type Google.com into your browser and press enter?”

#37
By far my favorite question to ask (and be asked) in an interview. As others point out, it's practically impossible to understand the entire system. At one point or another in my career I've been exposed to at least descriptions of most of the components, but if I wanted a processor engineer, I'd be looking for a different answer than a web developer, or a networking guy, etc. Essentially anyone involved in the modern world of IT has to be able to answer something they're good at - and more importantly, admit the parts they don't understand. You can't cheat your way through the question, hell, you could even know it's coming and you still can't "beat" it. You don't know if I'm looking for hyper-detail about something, business sense to skip over irrelevant (to the position) details of a certain level, etc.

Re: “What happens when you type Google.com into your browser and press enter?”

#38
post #22

Just thought I'd point out that this is an old repo from 2013. Probably should update the title before people starting submitting PRs in a doomed attempt to "not skip on anything".

The author just merged in a PR from (I'm guessing) an HN reader a few minutes after adding it.

Re: “What happens when you type Google.com into your browser and press enter?”

#39
post #31

So far, nobody has filled in the section on how a key-press event works its way through the OS, up to the window system, to the application, and to the code handling the input text box. Then there's what's happening at the Google end. Before search personalization, popular queries ("google", "Britney Spears") were handled by caches the first Google machine you talked to, and never even reached the search engine. Sinc…

"So far, nobody has filled in the section on how a key-press event works its way through the OS, up to the window system, to the application, and to the code handling the input text box."

That in itself is a multi-year discussion. From silicon chemistry theory, voltage biasing different types of substrates, the definition of ground, all the way to sofware control loops, eventing, software emulating parallellism, all the things happening and just waiting to happen on a single OS before you even press "g" on the keyboard will blow most people's minds away.

Re: “What happens when you type Google.com into your browser and press enter?”

#40

Earlier quoted context omitted.

The parent clearly said "so many people" and not "everyone" - that's a really important difference! I really struggle to believe that a competent software developer would be unable to answer this question with some degree of accuracy. It's not like it's a networking question - it's fantastically open-ended and covers everything from hardware, operating systems, networking, GUIs... and that's useful flexibility. On to…

Context is important. My team is a web systems team. I wouldn't expect someone that has written flight software to know the answers. I would expect someone that is advertising themselves as a senior web developer or web systems guy to.

My usual "Pass" answers end up being something specific to the stack a good .net developer should know, with a mutual agreement of just how awesome it is to think about the smallest steps and finding out how deep - even if in hobby terms - that person's drive to understand it is. There's no rattling off a "freebie" answer to it.
Post reply on HN