This week I had the opportunity to play around with JSONb, a feature added to Postgres 9.4. It is similar to the native JSON column introduced in 9.3 but with some extra benefits. The two largest values that I have found so far is that JSONb can be indexed and the cost of selecting keys is quite a bit less. I also made a Ruby/Docker playground you can use to run some tests yourself. Check out jsonb_tests if you would like to try some of these features out yourself!
Putting Out Fires
This week at work we were faced with one of those pre-launch fires. Stakes were high and emotions where even higher. Nothing feels worse in the work place then the pressure of tackling something like lost data or an uncontrollable outage. Needless to say, after long hours and several dead ends we were able to triage the problem and prevent a launch disaster. Looking back at it now, several days later, it reminded me of the time our barn caught fire growing up.
Commits That Matter
Work in software long enough and you’ll eventually need to do some serious digging into the code base to try and figure out why code was done a certain way. Commit messages can be a great tool when digging up the past to uncover these mysteries. Please don’t be that person who makes understanding the past harder. There a two main classes that I believe hinder this; pointless commits and useless commit messages. The following examples are a breakdown of such offenses.
Paging With Offset Kills Performance
This week I’ve been working on extracting records from a service and enhancing
them with extra data. The api of this service supports a fairly typical paging
style of ?page=x&limit=y
; which allowed me to form parallel requests to fully
saturate ingesting and processing of the data. At the start of task things
looked great with my measurements, it was processing about 1200 records a
second! Several minutes in the rate began to plummet to ~250 a second. What
was going on?
JSONb With Postgres and Rails
If you’re using ActiveRecord 4.2+ you’re in luck. It carries support for
Postgres’ JSONb
feature. JSONb
, and it’s cousin JSON
allow you to
store json natively as a column in your database tables. The power of these
is being able to then query directly against data stored in the data. For
instance the following query would be able to grab all email addresses where the
json column “preferences” has a key of contact_me set to true.
|
Better Ruby Hash Handling
You’ll be hard pressed to escape working with hashes in Ruby, but don’t make using them a painful experience. Here are some helpful tips that I’ve collected that I would like to share.
The Best Laid Plans
The best laid plans of mice and men often go awry.
If I can, I would like to take you into my imagination. Let us pretend we work at Widgets Inc. Now, Widgets Inc has been around for awhile and is going through a phase in it’s life where the technical decisions made by previous generations no longer seem viable. Our company struggles keeping it’s current infrastructure going, while at the same time wants to make some serious changes to it. One of the biggest challenges, we believe, is our lack of leadership in the company. If we had leadership with a grand vision to unify and replace all of our old architecture things would be so much better!
Building a New Floor
Yesterday had a great time replacing the floor of a shed that was rotting out. It’s a great reminder of just how great it is our family can get together and knock out these tasks together.
As Fast as Possible
One of the struggles that you hear time and time again is the one of management that wants software produced at an overly fast pace. I can of course sympathize with this; however, when the quality of a developer’s work is sacrificed in the name of speed things start to get tense. The outlook on any software project under negative tensions normally isn’t favorable.
Stop Auto-Connecting to Xfinity WiFi
I get so frustrated when Ubuntu automatically connects to xfinitywifi
. It is
not much to connect back to my work or home wifi; however, it wastes time and
sometimes can really disrupt my train of thought. Finally today I had enough
and I looked into how to stop this from happening. It turns out it’s not that
difficult and I wish I would have done this months ago!