Microservices for an non traditional global problem

Microservices require a major infrastructure. They are not a drop in replacement for a monolithic application. Many people will argue against them, and for good reason. Techniques and shortcuts that can be masked and hidden in a single application will shine through and could even be the death of your application infrastructure when it comes to microservices.

All examples I’ve seen come from a singular idea that all data comes in from an apache/nginx connection from a client and needs data returned as quickly as possible. The topic of microservices often oozes out from a single request and response path. I want to broaden this basic idea and talk about how they can be used to make a highly available, more robust and scalable application across the world (not just inside a single network).

An experience I would like to share is when a microservice setup is the only reasonable solution when dealing with a network and data stream structure that is unstable and extremely load heavy.

The problem:

Data coming in from cron import scripts, a tcp data stream and a direct writing mysql replication tool from a 3rd party services.

Solution:

Many small end points that can be restarted, scaled and updated at different times.

These services could be deployed across the globe, each can submit it to a queue (at the time it was gearman), and then a data worker could process and transform the data and store it into the database / cache system.

Once that data was in the system, a task would be triggered on a schedule to calculate and sum down the data to reliable parts, using another type of data processor. That processed data would be submitted into a redis cache and a pub/sub message would be sent off to the queue for the web server to pull that data and push it out through a websocket (which an angular app renders). All of this would not be possible on any other system than a distributed compute system using microserivces with a queueing system.

Summary

There are many ways to skin a cat. The hope here to to give a quick overview of what a microservice can be used for. They are great for taking task like billing processing, sending off welcome emails and doing some extra setup when some event occurs. If done right they give great performance enhancements to your web application. But they can be more than just a helper taking care of some annoying task, they can become the man application source.

References

Microservices by Martin Fowler

Design Patterns PHP

Continue reading Microservices for an non traditional global problem

Mentoring

I’ve worked many different developers from Senior to Junior and they all have one thing in common, they are looking for a mentor but also want to teach. Some may call it sharing ideas or showing off something cool but they want to describe the details of the code, their thought process on how they got there and why the end result is great but could get better.  I look at this and see teaching moments. 
I feel so many developers want to have a community that is open and sharing but many don’t feel ready or have the time. I’m hoping to challenge you all to start wanting to share. If you feel like you could write a post, feel free to message me and I’ll add it here. If it’s something small, tweet it and hashtag it #osrmentor and I’ll try and add them to a future post.
I’m also challenging myself here to take more time to share ideas, finish thoughts and open up channels to help teach, guide and come along side other developers to make projects go better, careers to advance and make life just a little easier on this journey we call development.

Continue reading Mentoring

Current Setup(s)

Browsers

Chrome (up to date)

  • Postman
  • Web Developer
  • Edit This Cookie
  • Gitlab Notifier
  • The Great Suspender

Safari (up to date)

Firefox (up to date)

For older versions of Firefox, I use a simple app called MultiFirefox.

You need to create a default profile for the up-to-date version and then a profile named after the version it is the profile it is for.

Firefox Release

Download each release you want, open the image one at a time, drag the Firefox.app file to your desktop, then rename it to the version it is Firefox_14.0.1.app. Take the file and now put it in your applications folder.

Open the MultiFirefox app and pick the version and profile you want and click start. You now can run as many version as you want and not break profiles.

Homebrew

This is a great application to install anything you need linux related.

Bash / iTerm2

Git

Git Flow

MySQL Workbench

Other options

Atom

Plugins

  • Atom Beautify
  • Bracket Matcher
  • Highlight Line
  • Highlight Selected
  • Merge Conflicts
  • Project Manager
  • Todo-Show

MacDown

OpenOffice

Mail

Evernote

SourceTree

Slack

Continue reading Current Setup(s)

Atom Editor

settings: command + ,
syntax highlighting: ctrl+shift+l
project manager: ctrl+command+p
fuzzy search: cmd+t

Plugins

Plugin shortcut desc
atom-beautify: ctrl+alt+b cleans up code
highlight-line: ctrl+shift+l
highlight-selected:
linter:
linter-php:
project-manager:
atom-terminal:

Atom Editor Shortcuts on Github

Continue reading Atom Editor

Mac OS X Bash – upgrade

Usually the bash on mac is good enough. But I’ve recently been making some more complicated shell scripts and found out associative arrays and using key to get values wasn’t working at all. So here is how to upgrade.

http://apple.stackexchange.com/questions/24632/is-it-safe-to-upgrade-bash-via-homebrew

Here is some bash array examples:

Bash associative array examples

Continue reading Mac OS X Bash – upgrade

API Response Suggestions

So todays coding is all about standards but also about the wild west but also making the code that comes out of the wild west a standard (which a lot of it does).

I’m torn every time I look something up that I’m not sure about or would like to see if there is a new suggestion or standard to follow.

I will work a little harder to take an idea to make it work to a standard but there comes a point that it just to much to keep up with and the next time I touch my “future proofed” code, it will be different.

So I look at what the wild west is doing then what the best practice is and then what posts on stackoverflow say and usually I take the best suggestion on stackoverewflow that is as close to a standard I found and try and clean it up best as I can and then stop worrying about if its 100% right. The only times I change my mind is if a best practice of another technology needs it and it makes my life easier than if I ignore it, it’s seldom but it does happen.

The Best Practice / Wild West Talk:

The Best Practice:

http://www.vinaysahni.com/best-practices-for-a-pragmatic-restful-api

The Suggestion of Best Practice:

http://jsonapi.org/format/

The “What I do” Best Practice:

http://stackoverflow.com/questions/12806386/standard-json-api-response-format

My 2 thoughts on this:

The Json API is pretty simple to implement, it seems to meet todays standards but is the extreme of Hypermedia Restful. Yes that new standards looks so nice but I’m sorry I’m building the API for our own app and know what I need, the overhead just isn’t worth it.

Suggestion #2 Standard JSON API

I do like using the HTTP Status Codes to better handle the type of Errors happening without depending on them solely for determining the state of our application. I do like the idea of just being able to check the HTTP Status first and then moving down to checking the error code of the response. Overall I think it gives the API a well rounded feel without it making it to complicated to know how the application is working plus it seems to better fit our current state with multiple different levels of coding standards and application structures with these legacy applications.

Continue reading API Response Suggestions