Q&A: Do DevOps and SREs Need to Know Algorithms and Data Structures?
Question
Some companies are asking me to solve problems and respond to interview questions based on algorithms and data structures. I’m actively looking for DevOps roles but I’m unable to clear those hard "Leetcode" problem solving questions.
Does a DevOps/Site Reliability Engineer need to know algorithms and data structures in addition to overall System Design? Please advise.
Answer
The short answer is "it depends". The follow up answer is "yes". Let's get into it.
Different Companies have Different Requirements
Whether or not a DevOps/Site Reliability Engineer (SRE) needs to know algorithms and data structures depends on the specific role and the company's requirements.
In general, though, it is helpful for DevOps engineers to have a basic understanding of algorithms and data structures
It is also important to note that the hiring process for DevOps and SRE roles can vary greatly between companies. Some companies may prioritize coding skills and require candidates to solve algorithmic problems during the interview process, while others may focus more on experience with specific platforms technologies, and tools.
Ultimately, the best way to determine whether or not you need to know algorithms and data structures for a specific DevOps/SRE role is to speak with the hiring manager or recruiter. They will be able to give you a better understanding of the specific requirements for the role and whether or not your skills and experience are a good fit.
Algorithms are Recipes for Solving Problems
Even if you don't plan to work with different algorithms and data structures every day, knowing how to work with them can be useful for many DevOps and SRE tasks.
For example, I once had the task of finding all the EBS volumes attached to all EC2 instances in an AWS account and calculating the total amount of disk space in use. A naive approach would be to go to the AWS console, look at each EC2 instance, find all the disks attached, and then sum the totals. This approach would be manual and perhaps error prone.
A more algorithmic approach was to script a solution using the AWS CLI. The first, also naive approach used the same approach as the manual approach, albeit in an automated fashion. Even though it was automated, it took a long time.
Recommended by LinkedIn
Knowing the tools I had available (the AWS CLI), I started thinking about how I could reduce the time it took to run the script. Reducing execution time is often a big part of thinking algorithmically. In the end, I was able to update my script to make fewer API calls to describe the EC2 instances and the volumes attached to them.
Using some algorithmic thinking, I was able to reduce my solution's execution time from about 1 minute to 5 seconds.
Here's a link to the Stack Overflow post where I discuss the EC2 volume problem.
Skilling Up for Algorithms and Data Structures
If you are struggling with solving algorithmic problems
Practice solving algorithms and data structures problems. There are many online resources that can help you with this. A few courses here on the Linked In platform include "Programming Foundations: Algorithms", "Algorithmic Thinking with Python: Foundations", and "Practice It: Python Data Structure"
Regardless of the resources your turn to, focus on the fundamentals. Don't try to memorize complex algorithms or data structures. Instead, focus on understanding the basic principles.
Be able to explain your thought process. When you solve a problem, be able to explain how you arrived at your solution. This will show the interviewer that you understand the problem and that you can think critically.
Be confident but don't be afraid to ask questions if you don't understand something. The interviewer will appreciate your honesty and willingness to learn.
Select Your Own Path
In the end, you'll have to make up your mind and pursue the opportunities that are the best fit for you and your skills.
If your ideal opportunity is with a company that requires substantial experience with algorithms and data structures, even for DevOps engineers, then make a plan to start leveling up in those areas.
On the other hand, if you are more interested in the tools and skills needed for most DevOps tasks, then focus on working with cloud platforms, scripting, and automating.
In either case, I hope you take a moment to learn a little bit more about thinking algorithmically and working with different data types. No matter which path you take, your career will be the better for it.
Related to this topic, here's a thread from Lawrence Lockhart on "mastering data structures and algorithms as a self taught dev." https://twitter.com/LDLockhartJr/status/1561250018006294528
Thanks for sharing knowledge, as always! I suppose not only algorithms and data structures, but a mild base of all interdependencies aggregated to the role (IT based or not) can accelerate and facilitate the process of new, lean processes that requires even less work and derivation. It's always a pleasure!
Great article. A good reminder that bash or python scripting can help make life a bit easier.