awaiting is the hardest part
Welcome to the inaugural issue of Off-by-none! 🎉 I’m so happy that you’re here. 🙌 For those of you that have been email subscribers for a while, this will look a little different. I hope you’ll stick with me; I think this will be interesting. For those of you that are new, welcome, and thank you for joining!
I’m a constant learner, and I’ve found one of the best ways to learn is to take great notes, and then share what you’ve learned with others. This is the goal of Off-by-none. Not to be perfect, not get on a high horse 🐴 and tell you what you should and should not do, but to encourage collaboration and experimentation. Let’s push the limits of serverless. Then let’s take what we’ve discovered, and disseminate it to the masses, so we can learn from each other’s mistakes AND successes.
This newsletter has been awhile in the making. I’ve got all sorts of ideas, but this too will be a constant experiment. Your feedback, ideas, contributions, and encouragement will go a long way to making this what I truly hope it will be. Please reach out to me and share your thoughts and suggestions. They will be greatly appreciated. 🙇♂️
Let’s get started!
When you have thousands of concurrents user and limited MySQL connections… 🚀
Lots of people think RDBMS and Serverless don’t mix, and unless you use a series of hacks and tricks, then you’re likely to have scaling problems given the way serverless containers handle concurrent connections. In the past, I’ve often mitigated this issue by increasing the
max_connections setting and gracefully handling errors. But now with Aurora Serverless, you can’t change that setting, which means LOTs of
Too many connections errors.
I’ll use DynamoDB for the majority of my serverless datastore needs, but it can’t match MySQL’s ability to create normalized data structures, enforce declarative constants, provide referential integrity, and enable ACID-compliant transactions. Sometimes, you just need a relational database. And sometimes, serverless forces us to think about things differently. 🤔
Even though serverless functions are stateless, we can still reuse connections. Not only that, but status commands, like retrieving the number of
max_connections and counting threads from the
PROCESSLIST, are fairly inexpensive queries. I decided to run some tests to see how efficiently (and effectively) serverless functions could manage their own distributed database connections. Turns out, pretty darn well! 😜
I spent some time and turned all my learnings from the past several years (as well as my new experiments) into a new NPM module called Serverless MySQL. It manages connections for you, cleans up zombies to maintain total connection use thresholds, and even makes working with MySQL connections in Node.js super easy by adding
async/await support and simple transaction workflows. I wrote a post about it called Managing MySQL at Serverless Scale that goes into a lot more detail.
You should still size your MySQL instance/cluster appropriately, but for one of my tests, I simulated 500 concurrent users per second with only 90 connections available. Not only did Lambda and MySQL not throw any errors, but the average response time was only 41 ms with the max being just over 3 seconds. Not too shabby. Bump your
max_connections up to something more reasonable for that kind of load, and you should never have to gracefully handle connection limit errors again. 🤘🏻
When you’re looking for some light serverless reading… 📚
I’ve had plenty to say about cold starts in the past, but how much do they really matter, and how do they compare across the Big-3 cloud providers (AWS, Azure, and Google Cloud)? Mikhail Shilkov does a pretty darn good job answering those questions in his post Serverless: Cold Start War. Definitely worth the read. ❄️
Erica Windisch start writing again too, and you won’t be disappointed. Lessons from building a Serverless Data Pipeline with AWS Kinesis and Lambda is a relatively short read, but it is loaded with invaluable insights. If you’re thinking about using Kinesis in production, you should probably read this. 🤓
Looking for some serverless best practices? Paul Johnston (yes, the Paul Johnston, legendary cofounder of ServerlessDays), published a post with some “relatively accepted” best practices. There is a lot of debate over these, and Michael Hart and Tyler Love from Bustle jumped in with quite a difference of opinion. Both the article and the Twitter thread are good reads. I have a feeling that this isn’t the last of this debate. 🍿
Finally, sometimes things are better late than never. Chris Munns, AWS Senior Serverless Developer Advocate, put out a post that contains a quarterly recap of all things AWS Serverless. AWS moves so fast that it’s often hard to keep up with all their innovations. This post outlines all the cool stuff AWS did with Serverless in Q2 2018. ⚡️
When getting through airport security is harder than implementing serverless security… ✈️
I’ve got some travel plans coming up! I’ll be heading to ServerlessDays NYC on October 30th and I will be going to AWS re:Invent this year! I’m hoping to meet a lot of you in person, but I’ll also be taking copious notes and will be sure to share what I learn with all of you. If you’ll be at either event, connect with me via Twitter, LinkedIn, Facebook, or email so we can meet up (and maybe grab a few 🍻).
When you join the “My post made it to the front page of Hacker News and my site crashed” club… 🏅
I’ve been very grateful for all the positive responses to my Serverless Microservice Patterns for AWS post. Lots of people found it very useful and have been using it as a reference, which is great. Someone did me the honor of posting the link to Hacker News, and on Sunday it made its way to #7! Well, my self-hosted WordPress blog running on a single EC2 instance couldn’t handle the traffic, and my site crashed. 💥🤦🏻♂️
But it turns out that I’m in good company. Yan Cui had the same thing happen to him earlier this year. He decided to make his blog serverless by using Shifter, a service that converts your WordPress blog into a static, serverless site. I really like this idea, but at the same time, I’m also really sick of WordPress in general. I’ve actually been thinking about this for quite some time and should have more thoughts to share soon.
Serverless Star of the Week ⭐️
There is a very long list of people that are doing #ServerlessGood and contributing to the Serverless community. These people deserve recognition for their efforts. So each week, I will mention someone whose recent contribution really stood out to me. I love meeting new people, so if you know someone who deserves recognition, please let me know.
This week’s star is Slobodan Stojanović (@slobodan_). Not only did he write the book on Serverless Applications with Node.js, but he also has a number of great serverless posts (like here and here). But the reason I chose Slobodan this week is because of a recent talk he gave at Frontend Conference in Zurich. I wasn’t able to be there in person, but when I saw his slides, I was inspired. Convincing people to adopt serverless is a bit of a passion of mine, and the fact that Slobodan was introducing serverless to an entirely new audience (frontend developers) is a positive step towards more adoption. And, I’m also super jealous by how good his artwork is!
I hope you enjoyed this first issue of Off-by-none. It wouldn’t be possible without you and the contributions of a vibrant Serverless community. Please send me your feedback so I can continue to make this newsletter better each week. Reach out via Twitter, LinkedIn, Facebook, or email and let me know your thoughts, criticisms, or even how you’d like to contribute to Off-by-none.
Thanks again! And I hope to see you again next week! 🤞
Share this newsletter with your friends and coworkers!
Off-by-none is a weekly email newsletter that focuses on the technical details of building applications and products in the cloud using serverless technology. Together we can become better developers and product people by making fewer mistakes as we learn from each other. Off-by-none is the idea that we can become exceptional at what we do, if we are willing to put in the work. Join me on this journey as we help the community work to develop best practices, share our ideas, and learn to build better cloud-based software.
I respect your privacy and I will NEVER sell, rent or share your email address.