From the category archives:

Development

Since the introduction of the NoSQL database model to the world, there’s been a flurry of proponents and detractors that seem to fall into a 50-50 distribution. Some of the discussions have become very heated, others are just laugh out funny.

One of the things that have been talked about in the blogosphere is that you shouldn’t embrace NoSQL as the first solution to your problem. There is time — they say — to scale it using NoSQL later on. To me that makes no sense: NoSQL engines have become mature technologies that can be used by any enterprise, big or small.

Reddit user cogman10 mentions on this blog post:

Picking Tech A over Tech B is NOT a premature optimization. Would the author claim that “Using InnoDB is a premature optimization because MySQL is better supported!” It is called planning, you do that whenever you write a new application.

Use the database that best matches your data. If some non-relational database is a perfect match for the data you want to store, by all means use it. Don’t give two shits about people like the author that think SQL is the one and only query language. (hell, I wish that SQL would die in flames, but it is heavily built into current business models. Not because it is the best, but because it is common.)

Insisting on the wrong tech is not premature optimization. It is stupidity.

But in some cases, there might be a mixed option available: using both SQL and NoSQL.

High Write / Low Reads

Writes are expensive on SQL engines. This is because, unless you use sharding, you usually write on a Master Server. But sharding (in effect writing to multiple “masters”) makes your solution to not be ACID — “Atomic, Consistent, Isolated, Durable transactions” — anymore (i.e. a write on master 1 might no be available for some time on master 2).

This is where NoSQL shines: writes can happen on any box and even though they’re BASE – ”Basically Available, Soft State, and Eventually Consistent” — the “eventually” piece is usually really fast.

The Mixed Approach

If you have relational model that you would like to still use, you could potentially leave the read data on a SQL engine (being careful to avoid super complex joins, which are also very expensive in terms of load) and then host the write-heavy tables on a NoSQL engine.

Why not code everything using NoSQL from the start? Because there are benefits to using SQL, like joins and or other features that you might not want to give up. You could also potentially need to write much more code to adopt the different data approach that NoSQL requires.

Take a look at the diagram below (click to enlarge):

As you can see on the diagram, we have web users coming into a load-balanced cluster of web server instances that have connections to both MongoDB server instances (NoSQL) and a connection to a MySQL slave server instance on a cloud environment. This part of the network can grow or shrink horizontally very easily, by adding web servers, mongo servers or MySQL slave servers. I would probably group up to four web servers per MySQL slave, and then create a new MySQL slave instance for every new group of four.

The MySQL Master lives in a physical colocation environment and there are processes running there that update the relational data.

Let’s see an example. Say you have a heavily visited shopping website where you need to have complex product information that contains many joins (product to manufacturer to inventory levels; that would be the SQL piece), but you need to track the product pages people are visiting, sort of a log of their activity. You could have this high-write activity happening on the MongoDB NoSQL servers. And because they will actively be written in the sharded MongoDB servers they will be scalable.

As traffic grows, you can add more MongoDB servers and the load will be distributed properly. The product information might change once per day or some other low frequency schedule, which makes it perfect to have on a read environment. Remember, reads are cheap.

If you need data from the MongoDB servers from your colocation environment, you could potentially run cron-based jobs that download the data from the MongoDB servers securely in a scheduled form.

You could also potentially put a load balancer on front of multiple MySQL Slaves, if you wanted a quickly scaling setup.

The main point I’m trying to make is the following — use the right data solution to your problem. SQL, NoSQL or both. Don’t be fixated on the technology, but on what you need to accomplish.

{ 0 comments }

7 Habits For Highly Effective Developers

November 7, 2011
Thumbnail image for 7 Habits For Highly Effective Developers

A new developer joined our tech team this week, and I’ve often seen how it takes some time for new recruits to get the hang of a new development environment. I thought it’d be a good idea to sit down with him and give him some pointers so that he can move in the right [...]

Read the full article →

Mobile is About to Explode, Is Your Startup Braced?

October 20, 2009
Thumbnail image for Mobile is About to Explode, Is Your Startup Braced?

Mobile computing was a segment that was very much in Yahoo!’s roadmap when I worked there back in 2005. The problem with mobile was the variety of cell phone manufacturers and carriers which made it close to impossible to develop anything that looked like something useful.

Fast forward an outstanding 4 years and we see a completely different picture, thanks to the two major punches we’ve all witnessed: Apple’s iPhone and Google’s Android. It is not crazy to know that mobile is poised to surpass PC’s as the main consumption point for users. Just read this quote from Google’s CFO in their most recent earnings call:

On a quarter over quarter basis, mobile searches grew 30% on Google. It tells you something about the mobile space, the smartphones, and how they are transformative. They are basically transforming how people live on a mobile basis. If we move forward the adoption of these mobile phones by lowering the cost because it is open source, think of how many searches that will produce.

Google’s CEO mentioned on the same conference call that “Android Adoption is About to Explode”. Some reference that Schmidt was talking about Verizon’s launch of the Motorola Droid, the best competitor, according to people who have tested it, to the iPhone.

I disagree. I think Schmidt is looking at the big picture.

Read the full article →

Building Startups Following the Bruce Lee Philosophy

October 14, 2009
Thumbnail image for Building Startups Following the Bruce Lee Philosophy

I’ve been watching (little by little, as I’ve been very busy) a great documentary I DVR’d about Bruce Lee’s influence on other artists and in Western culture in general and I’ve found out that Lee was actually very much into philosophy.

In one of his few televised interviews (see video below) he mesmerizes us with this thought:

Be formless… shapeless, like water. If you put water into a cup, it becomes the cup. You put water into a bottle; it becomes the bottle. You put it into a teapot; it becomes the teapot. Water can flow, or it can crash. Be water, my friend…

I immediately thought how this could be applied to any entrepreneur thinking of building a new startup and how this is the best approach you could have. At the start (and hopefully throughout) you need to be a flexible enterprise with the ability to morph to your customer’s needs.

Read the full article →

Estimating Time to Launch a Startup Using The 1,000 Hour Rule

September 16, 2009
Thumbnail image for Estimating Time to Launch a Startup Using The 1,000 Hour Rule

There is this moment in all things creative where you stop and say “What am I doing?”. It doesn’t matter if you’re writing a novel, painting on canvas or coding a website (and some would say starting a relationship).

You start with a fiery passion, the eureka moment where everything looks illuminated, and your legs tremble just thinking that someone else could be doing what you’ve imagined.

You start getting things done, revel at the first sparks of creativity you see unfold before your eyes. You immediately have the urge to share this excitement with your closest friends and family. You work on it some more, and finally release it to more users, only to find that they don’t understand or get your creation.

What’s next? More work.

The business thinker Malcolm Gladwell has reported that to become a real expert at something, you need to practice it for at least 10,000 hours. That’s eight hours a day for almost three and a half years.

I was thinking about this rule and how it kind of makes sense (even though some critics question Gladwell’s rules) and how it could be applicable for a startup.

I’ve been involved in many startups during my career, both personal and work projects, and going back on the times it took to get stuff from concept to release versions, I can safely state the following rule:

To get any startup project in a launch-ready state, it must have been developed for at least 1,000 hours

Read the full article →

Google Has Done Bad Moves in the Past. Chrome OS is One of Them.

July 8, 2009
Thumbnail image for Google Has Done Bad Moves in the Past. Chrome OS is One of Them.

Today, as I opened my FriendFeed, I was astonished as I read, via Rob Diana, the announcement that Google will build a “Chrome OS”, geared initially to netbook users who only run web applications.

If you said “WTF?”, you were thinking exactly like me.

If you read through the official press release and skip over the marketing parts of it, you’ll come to a paragraph that sums it up for me:

While there are areas where Google Chrome OS and Android overlap, we believe choice will drive innovation for the benefit of everyone, including Google.

Why does Google need to offer two Operating Systems? Why not make an Android “light” and a full Android.

Read the full article →

Firefox 3.5 Threatens Adobe Flash with Video Tag

June 25, 2009
Thumbnail image for Firefox 3.5 Threatens Adobe Flash with Video Tag

I have been waiting to upgrade to the new version of Firefox. Yesterday I decided to take the plunge and download it. As expected, some of the plugins didn’t work, including Firebug and Alexa’s Sparky (although I then got an update that Firebug does now work with 3.5).

Upon restarting my machine and opening the new browser client, I got into a welcome page where a lot of the bells and whistles are explained. But what caught my attention the most was the fact that the new Firefox supports the new native video tag from HTML 5 which I had read about in the past. The video looks like the still above, which renders a basic video player with a play button, a scrub bar and a volume widget. The video looked fantastic.

Read the full article →

Installing and Configuring Memcached for PHP in Fedora

April 15, 2009

Memcached is an awesome memory object caching system that allows you to store highly requested data in RAM, across a network of servers, saving you from hitting your Mysql (or SimpleDB) database. This saves time and money for all of us.

This is a rather technical post, but I’ve done this three times already and always forget the steps to install and configure Memcached for PHP in Fedora, so if you don’t know what Memcached (or Fedora) is, you might want to skip this. But for those developers out there who are searching for this in Google, here are, step by step, how to enable Memcached for your box.

Read the full article →

Building A Social Application on the Cloud Part 1: Why build it on the cloud?

April 10, 2009
Thumbnail image for Building A Social Application on the Cloud Part 1: Why build it on the cloud?

I’ve always been a David Letterman fan and one of the most famous sections of the show is the Top Ten List. Basically they pick a theme from current news and make a funny list around it, sorting the ones that are the most funny on the top.

I thought that this would be a great social tool to build: a crowdsourcing tool for Top Ten lists. But having people create ten items sounded like too much, so I decided to pair it down to five.

Thus I had my application: The Top5.

Read the full article →

Building A Social Application on the Cloud

April 10, 2009
Thumbnail image for Building A Social Application on the Cloud

As I do more and more research about the Cloud Area Network, I’ve also found that people (technical and non-technical) still don’t get a clear grasp of how and why we should build applications that run on the cloud.

I thought the best way to explain the concept was by building a simple application that would use infrastructure as well as logic that would demonstrate the approach and the benefits of a cloud app.

Read the full article →