Podcast: Play in new window | Download
Subscribe: Apple Podcasts | Spotify | TuneIn | RSS
It’s time for more DevOps fun as we continue learning about the Twelve-Factor app. This week we dive into the next three chapters: port binding, concurrency, and disposability.
Wait, the survey. Oh my Flying Spahgetti Monster. We forgot about the survey. Again. Fine, we’ll make this the survey instead.
News
- Jeff tells us that sp_whoisactive > sp_who2.
- Brent Ozar’s How to Use sp_WhoIsActive to Find Slow SQL Server Queries
- Adam Machanic’s archieve of sp_whoisactive articles
- We get lost answering Rebecca’s question. Mostly due to Abba.
- StackOverflow 2015 Developer Survey
VII. Port Binding
- Export your app’s services via port binding
- Your app doesn’t rely on the existence of services. Instead those dependencies are bundled with your app making your app self contained.
- Using this approach allows your app to act as a backing service.
Importance: Medium
VIII. Concurrency
- Horizontally scale your app across multiple process types.
- Your app should not try to do it’s own process management or daemonizing, but instead rely on a process manager like Upstart or Foreman.
- This chapter felt out of place after learning about the first seven chapters. Maybe a listener better understands this chapter as it fits into the overall twelve-factor app and can explain it to us. Add a comment below.
Importance: Low
We also discussed the importance of the MVP, the minimal viable product. Sometimes, it’s important to just get your idea out there and worry about architectural decisions like those discussed in the twelve-factor app later. Bill Gross gave an interesting Ted talk discussing the single biggest reason for success for many startups may just be nothing more than timing in the market.
IX. Disposability
- Start fast, stop fast. The app can be started or stopped at a moments notice facilitating elastic scaling, i.e. growing or shrinking the number of active instances to meet current demand.
- When shutting down gracefully, worker processes should return jobs to the worker queue so that another process can pick up the job and continue on.
- When shut down non-gracefully, like a power outage, the job should be automatically passed on to another process after a timeout.
Importance: Medium
Resources We Like
- 12factor.net
- 12-Factor Apps in Plain English
- Crash-only software
- The Lean Startup
- The Phoenix Project
Tips & Tricks
- Sometimes you want to modify a collection, i.e. a List<T> or Dictionary<TKey, TValue> for example, that you are currently iterating over in a loop. However, in .NET, you’ll get a “Collection was modified; enumeration operation may not execute” runtime exception if you modify the collection you’re iterating over. So what to do? One way is to use a new collection object that can either represent the desired end state, i.e. only contains the items you want in the collection, or a list of items to be added or removed, however, this may be inefficient depending on the items to be added or removed. It’s a common question on Stack Overflow. Here’s an example where Allen illustrates maintaining a separate list of modifications to be swapped in later.
- Efficiently processing multidimensional arrays requires processing the inner arrays first before moving onto the next array element. So if X is an array of arrays, where each Y is an array at some index of X, your pseudocode to process this might look like for each array in X, process each element in Y. This works great for row-major order array arrangements. If, however, you’re working with a coordinate system, the idea is the same, however, because X and Y represent coordinates, we want to iterate over each X element first before moving on to the next Y. Therefore, your pseudocode would be for each Y array, process each element in X.
- Create a task with a reminder(s) for the exact date/time your password is going to expire. On a Windows box connected to an Active Directory domain controller, type net user yourid /domain where yourid is your domain id, which are commonly in the form of firstname.lastname or flastname but may vary for your organization. Find the Password expires value and use that to create a task to change your password at that exact time. Then set a reminder (or reminders) ahead of time, to remind you that your password is expiring soon, such as a 7 day reminder. That should give you plenty of advanced notice to change your password before it’s too late, and if it’s not convenient to do so at the time of the reminder goes off, you can always snooze the alarm until it is.
Sharing is Caring
We’re approaching the holiday season, and nothing spreads the holiday cheer more than telling all your friends about Coding Blocks. Seriously, I’m not making that up. I think there’s a Folger’s commercial about it.
And while you’re in the giving mood, head over to www.codingblocks.net/review and leave us your most awesome review. It really is the gift that keeps on giving.