Live data from Hacker News

How We Work on Queries at GitHub

samlambert.com

21–30 of 30 posts

Re: How We Work on Queries at GitHub

#21

I really wish this went into more detail. You are notified when a query is slow. You can EXPLAIN it in chat so everybody can see. What happens next? Are slow queries treated as high priority? Is there any tooling around debugging complex queries? Basically, what makes GitHub's process different to the decades-old "grep the slow query log and run an EXPLAIN"?

> Basically, what makes GitHub's process different to the decades-old "grep the slow query log and run an EXPLAIN"?

Sam's chatops tools opens this process up to a lot more people that otherwise wouldn't be comfortable logging on to servers to access the slow query logs (assuming that they even have access to the servers). It's a great way for app developers to level up their sql skills from other more experienced coworkers.

The impact of slow queries determines their priority. How frequent are the slow queries? Is it from a background job, or does it cause exceptions on important pages or API calls?

I don't know if this process is streets ahead of what other companies have, but it's made a hugely positive impact on our MySQL infrastructure.

Re: How We Work on Queries at GitHub

#22
post #19

Why doesn't Github open source their products/libraries regularly ? There is too few open source projects from Github on Github.

We do! https://github.com/github https://github.com/libgit2 https://github.com/boxen When it's easy to extract, well-documented, and has a clear team of maintainers, we try to open source. Sometimes it's difficult to nail one or all of those bullet points, though.

You forgot https://github.com/atom

Re: How We Work on Queries at GitHub

#23

Earlier quoted context omitted.

Unfortunately not. It is so closely tied to our applications.

Thanks for posting this! I like hearing about internal tooling. Is there more on the query tagging? How do you guys bubble query annotations through the stack? I don't know if you're at liberty to discuss further, but how has it been scaling a giant Rails app? Have there been any pushes to break it up into smaller components? Ie. fast moving stuff stays Rails, core infra moves to something statically typed?

The query annotations show up as a mysql comment next to the query. I don't know if we have any automatic indexing of the annotations themselves.

We try to stick to ruby/rails since so many people are comfortable in that environment. We try to balance the desire to break pieces out with the fact that it lowers the number of devs qualified to work on it.

Re: How We Work on Queries at GitHub

#24
post #19

Why doesn't Github open source their products/libraries regularly ? There is too few open source projects from Github on Github.

We do! https://github.com/github https://github.com/libgit2 https://github.com/boxen When it's easy to extract, well-documented, and has a clear team of maintainers, we try to open source. Sometimes it's difficult to nail one or all of those bullet points, though.

Haystack looks interesting ;)

Re: How We Work on Queries at GitHub

#25

Earlier quoted context omitted.

Unfortunately not. It is so closely tied to our applications.

Thanks for posting this! I like hearing about internal tooling. Is there more on the query tagging? How do you guys bubble query annotations through the stack? I don't know if you're at liberty to discuss further, but how has it been scaling a giant Rails app? Have there been any pushes to break it up into smaller components? Ie. fast moving stuff stays Rails, core infra moves to something statically typed?

Looks like they're using https://github.com/basecamp/marginalia for the tagging.

Re: How We Work on Queries at GitHub

#26

Earlier quoted context omitted.

Unfortunately not. It is so closely tied to our applications.

Thanks for posting this! I like hearing about internal tooling. Is there more on the query tagging? How do you guys bubble query annotations through the stack? I don't know if you're at liberty to discuss further, but how has it been scaling a giant Rails app? Have there been any pushes to break it up into smaller components? Ie. fast moving stuff stays Rails, core infra moves to something statically typed?

There is a little more info on query comments here: http://samlambert.com/posts/the-power-of-query-comments/

Re: How We Work on Queries at GitHub

#28

I really wish this went into more detail. You are notified when a query is slow. You can EXPLAIN it in chat so everybody can see. What happens next? Are slow queries treated as high priority? Is there any tooling around debugging complex queries? Basically, what makes GitHub's process different to the decades-old "grep the slow query log and run an EXPLAIN"?

If we get a spike in slow queries we get alerted via pager etc. If a query is slow enough to be killed Hubot tells us https://twitter.com/isamlambert/status/502818333914566656

I am working on some query linting as a side project.

Re: How We Work on Queries at GitHub

#29
post #24
post #19

Earlier quoted context omitted.

We do! https://github.com/github https://github.com/libgit2 https://github.com/boxen When it's easy to extract, well-documented, and has a clear team of maintainers, we try to open source. Sometimes it's difficult to nail one or all of those bullet points, though.

Haystack looks interesting ;)

You can't expect them to opensource everything, i think it's awesome they opensourced hubot!
Post reply on HN