Facebook MySQL database engineers ready for Percona Live London 2014
Join the DZone community and get the full member experience.Join For Free
originally written by tom diederich
with 1.28 billion active users, facebook mysql database engineers are active and extremely valuable contributors to the global mysql community. so naturally they are also active participants of percona live mysql conferences! and next week’s percona live london 2014 (nov. 3-4) is no exception. ( register now and use the promotional code “facebook” to save £30!)
i spoke with facebook database engineers yoshinori “yoshi” matsunobu and shlomo priymak about their upcoming sessions along with what’s new at facebook since our last conversation back in april.
tom: yoshi, last year facebook deployed mysql 5.6 on all production environments – what have you and your team learned since doing that? and do you have a few best practices you could share? i realize you’ll be going into detail during your session in london ( mysql 5.6 and webscalesql at facebook ), but maybe a few words on a couple of the bigger ones?
yoshi: mysql 5.6 has excellent replication enhancements to use in large-scale deployments. for example, crash safe slave makes it possible to recover without rebuilding a slave instance on server crash. this can greatly minimize slave downtime, especially if your database size is large. there are many other new features such as gtid, multi-threaded slave, streaming mysqlbinlog and we actively use them in production.
for innodb, online ddl is a good example to ease operations. many mysql users are doing schema changes by switching masters. this can minimize downtime but requires operational efforts. online ddl made things much easier.
tom: facebook is an active and extremely valuable part of the overall mysql community and ecosystem – what are some of the key features and improvements you’ve contributed in the past year since moving to mysql 5.6?
yoshi: for innodb, i think online defragmentation and faster full table scan are the most valuable contributions from facebook in 5.6. i have received very positive feedback about faster innodb full table scan (logical readahead). my colleague rongrong will speak about something interesting regarding online defragmentation at percona live london. for replication, we have done many optimizations to make gtid and mts work without pain. semi-synchronous mysqlbinlog and backported loss-less semisync from mysql 5.7 are very useful when you use semi-synchronous replication.
tom: shlomo, your sesson, “ mysql automation at facebook scale ,” will be of great interest to dbas at large and growing organizations considering that facebook has one of the world’s largest mysql database clusters. what are the two or three most significant things that you’ve learned as a database engineer operating a cluster of this size? and has anything surprised you along the way (so far)?
shlomo: this is a great question! we like to speak of “10x” at facebook when thinking of scaling. for example, what would you do differently if the number of servers you had was 10x more than what it is? this type of mental exercise is surprisingly useful when working with systems at scale. if you, or any of the readers, try to extrapolate this about systems you manage, there will be things you’ll be imagining about how a system like this would be – and you won’t be too far from our reality in many aspects.
you’d imagine that we automate much of the single units of work, like master/slave failover, upgrades and schema changes. you’d suspect we have automated fault detection, self managing systems, good alarming and self remediation. you’d presume that if you’re used to running a command on 100 machines, you’ll now be running it on 1000. at least that’s what i thought to myself, so these are not the things that surprised me. there are a few fundamental shifts in one’s thinking when you get to these sizes, which i didn’t foresee.
the first one is that there is absolutely no such thing as “one-off.” if there is a server somewhere that hits a problem every three years, and you have 1000 servers, this will be happening daily! take it to 10,000 servers, and you can see absolutely nothing is a “one-off”. we can’t write things off as “worst case, i’ll get an sms.” whatever it is, we have to chase it down and fix it. not just that – to deploy a fix at scale can require writing fairly large amounts of code, a fix that could be deployed manually by a dba in smaller environments.
the second one is adapting to constraints which are very pragmatic and tangible. if you’re on aws, you’re pretty much isolated from things like worrying where your servers are physically located, when they go over their lifetime, and if the firmware on the switch in the rack needs to be upgraded. if you’re a small shop and have a few racks up in a co-lo, hardware maintenance is just not as frequent, but it becomes more painful as you grow.
at facebook, we run our own datacenters! we need to work around interesting challenges, such as running datacenters that have highly variable compositions of server hardware. since we have so many servers, something is always going on. racks of servers need to be moved. whole clusters need to be rebuilt or refreshed, to be made better, faster, stronger. new datacenters are constructed, others decommissioned.
tom: and this is where automation comes into the picture, right?
shlomo: we have had to build a lot of automation to make these operations seamless, and we work closely with the site ops teams on the ground to coordinate these logistically complicated processes.
another thing my team does in this space is planning capacity and hardware purchases. since we build our own servers, the turnaround time between ordering and getting machines is quite long, so proper planning is paramount. buy too much, and you’ve wasted millions of dollars. buy too few servers, and there won’t be space for user growth and upcoming projects. the sheer scale makes these decisions more complicated and involved.
these things have actually made my job much more interesting, and i think i’d find it hard to adjust to a smaller environment.
tom: last april facebook announced a move to the newly created webscalesql. yoshi, do you have an update on where webscalesql is today? and i know it’s early, but has there been any impact on facebook yet?
yoshi: webscalesql is a collaboration among engineers from several companies that face similar challenges in running mysql at scale. collaboration is nothing new to the mysql community. the intent is to make this collaboration more efficient.
we are based on the latest upstream (currently mysql-5.6.21), and added many features. we added patches to improve innodb performance around compression lru flushing, locking, numa support, and doublewrite. we statically link semi-sync based on lessons learned at facebook environments (plugin-lock caused hot mutex contentions). we have many upcoming features such as async clients.
we will continue to track the upstream branch that is the latest, production-ready release (currently mysql 5.6). we are continuing to push the generally useful changes we have from all of the participants. if you think you have something to contribute, get in touch!
tom: i remember being surprised earlier this year when you told me there was usually just one mysql operations team member on call at any given time thanks to “robots.” how many robots did your team build and what do they do? oh, and should rank-and-file dbas around the world be worried about losing their day jobs to these robots?
shlomo: instead of becoming obsolete as some fear, our team is shifting its focus from smaller to larger problems, as we rise higher in the levels of abstraction. our team has progressed with the requirements of the role. from being a team of dbas that automate some of their work, we have become more like production engineers. we design, write and maintain mysql/facebook-specific automation that does our work for us.
while we build these software “robots” to do our work, we also have to maintain them. the job of the oncall is to fix these robots when they malfunction, and that can sometimes be difficult due to the size of our codebase.
in regards to employment concerns, i’d say our work has become more interesting, and the amount has increased. it definitely did not decrease, so if facebook is indicative of other companies, jobs are not at risk just yet. speaking of jobs – if what we’re doing sounds interesting, we’re hiring!
oh, and as for details about these “robots” – that’s the topic of my talk next week in london. come and hear me speak if you want to know more!
tom: yoshi, you also will host a session titled “ fast master failover without data loss .” i don’t want to give too much away, but how did you get failover to work at scale – across vast datacenters?
yoshi: master failure is a norm at facebook, because of the large amount of servers. without automation, it is not realistic for a limited number of people to manage. we have a very interesting infrastructure to automate failure handling at facebook scale. to automate stuff, reliability is important. unreliable automation makes engineers spend lots of time fixing things manually, and that increases downtime. it is also important to define what to automate and what we shouldn’t automate. define failure scenarios and write good test cases and continuously integrate. there are multiple failure scenarios like the ones below and you’ll hear about each in detail at my session:
– mysqld crash
– mysqld stalls
– kernel panic and reboot
– error spikes caused by h/w failure
– error spikes caused by bad application logic
– rack switch down
– multiple rack switches down
– datacenter down
tom: what other sessions, keynotes or events are you looking forward to at percona live london 2014 ? and are you guys planning on attending the mysql community dinner?
yoshi: “ mysql 5.7: performance and scalability benchmark ” (led by oracle mysql performance architect dimitri kravtchuk) . and yes, we’re looking forward to meeting with people at mysql community dinner !
tom : thanks again yoshi and shlomo for taking the time to speak with me and i look forward to seeing you both in london next week!
and readers, i invite you to register now for percona live london using the promotional code “facebook” to save £30. i also hope to see you at the mysql community dinner next monday (nov. 3). space is limited so be sure to reserve your spot now and join us aboard our private double-decker bus to the restaurant.
i’d also like to thank the percona live london 2014 conference committee for putting together a terrific event this year! the conference committee includes:
- dailymotion’s cédric peintre, conference chairman
- percona’s david busby
- mariadb’s colin charles
- ebay classifieds group’s luis motta campos
- booking.com’s nicolai plum
- oracle’s morgan tocker
- spil games’ art van scheppingen
Published at DZone with permission of Peter Zaitsev, DZone MVB. See the original article here.
Opinions expressed by DZone contributors are their own.