From the category archives:

Startups

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 →

When Is It Right For a Startup To Pivot?

October 24, 2011
Thumbnail image for When Is It Right For a Startup To Pivot?

A pivot is defined as a quick turn by either a company or a project. Sometimes it’s like a shift in focus in a small startup. Other times we see it in companies as large as Google, when it announced  it was shutting down Google Buzz, a service that it announced to great fanfare but [...]

Read the full article →

Web Platforms, Not Web Portals

November 17, 2009

In talking to different startups in the past weeks, it’s very clear to me that businesses haven’t grasped yet how the Internet has shifted from the destination paradigm to the platform paradigm.

In a post titled “The Web in Danger”, Anil Dash compiles and adds to the thoughts of Tim O’Reilly, Doc Searls and Chris Messina about how the web is in danger of losing its essence: the destination URL.

So far people have thought of websites by the URLs they enter on their browsers to consume its services. But today, they are thinking of businesses as omnipresent services. They want to be able to do everything they normally do on the URL, using their iPhone or on Facebook or on their Chrome OS powered netbook.

They want to fire up your application using an icon; not enter an address on a URL window.

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 →

Why Ranking Matters

October 15, 2009
Thumbnail image for Why Ranking Matters

We live in a world full of statistics. We’re always measuring ourselves against our competitors and most of the time success is tied with performance and relative positions.

The web is specially a place where everything is measurable. Every click, visit, pageview, source can be added, combined and reported.

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 →