News for hackers. Stuff that matters.
Re:The Uber Engineering Tech Stack, Part I: The Foundation by Animats on Sunday July 24, 2016 @03:09AM (#12152570)
It's interesting that they don't break the problem apart geographically. It's inherent in Uber that you're local. But their infrastructure isn't organized that way. Facebook originally tried to do that, then discovered that, as they grew, friends weren't local. Uber doesn't need to have one giant worldwide system.

Most of their load is presumably positional updates. Uber wants both customers and drivers to keep their app open, reporting position to Master Control. There have to be a lot more of those pings than transactions. Of course, they don't have to do much with the data, although they presumably log it and analyze it to death.

The complicated part of the system has to be matching of drivers and rides. Not much on that yet. Yet that's what has to work well to beat the competition, which is taxi dispatchers with paper maps, phones, and radios.

Re:The Uber Engineering Tech Stack, Part I: The Foundation by genmon on Sunday July 24, 2016 @05:24AM (#12152810)
Uber is pretty formidable in building and growing a two-sided market. I suspect it's tuned continuously, at high resolution (in space and time), with levers I mostly don't know. And that's got to be a big contribution to the complexity of the stack.

This of it this way. A standard e-commerce site, or SaaS with low-touch marketing... there are a crazy number of KPIs to monitor, loads of levers (e.g. what's the right discount to fix basket abandonment). The instrumentation to track all these conversation funnels (and to do A/B tests to see what works) is half the job.

But at least we have a common understanding of the metrics and the levers -- for SaaS, say, there are tons of similar services, and the knowledge is shared in the community.

Uber? How do you grow while maintaining market liquidity every evening of every week? If you artificially hike demand from passengers in a particular neighbourhood (say with coupons), does WOM amongst potential drivers work to increase the driver pool before the passengers get frustrated and move to Lyft?

All of this is new. So how do you create the tech to track not just all the data you need, but all the data you might need, plus the capabilities to do tests to figure out what levers to pull? Hard.

I have no particular insight into this. But my guess is that Uber isn't flying blind - their growth has been no accident - and the complexity of their tech is due to instrumentation not operations.

Re:The Uber Engineering Tech Stack, Part I: The Foundation by matthewrudy on Sunday July 24, 2016 @05:44AM (#12152842)
I work on an uber-like system, but with ~3 backend devs rather than 100s.

We made the opposite decision, cloning our full stack for each new market.

That's great for scalability, but is a nightmare for devops.

If anything we want to find a way to move to one global system, And then slice down the bits that can be local:

Eg. Create a local order matching service, but keep orders, payments, and user accounts global

Re:The Uber Engineering Tech Stack, Part I: The Foundation by tupshin on Sunday July 24, 2016 @01:17PM (#12153874)
Recipe:

Create a global Cassandra cluster with regional datacenters.

Use one keyspace per region

Use per-keyspace replication to only replicate that region's data locally, and to one or more additional datacenters

Have stateless app servers colocated with Cassandra in each DC handling all local traffic

Run spark on top of Cassandra to do analytics, or to do the etl to a dedicated analytics system

Optionally have a single "master" DC, with replicas of all data from all locations, that doesn't serve end user traffic, but is to allow efficient cross region analytics.

Profit (optional step)

And yes, the company I work for (Datastax) has a product and services to help make it simple.

Re:The Uber Engineering Tech Stack, Part I: The Foundation by scaleout1 on Sunday July 24, 2016 @01:33PM (#12153968)
Thats an interesting approach. One question though, in our use case user often travel from city to city and country to country. How do you model that if you are only using local DC and local replications?
Re:The Uber Engineering Tech Stack, Part I: The Foundation by methehack on Sunday July 24, 2016 @02:34PM (#12154216)
I think the regional keyspaces would be have to be caches -- denormalize it, basically. Pop/re-fresh people into the geo-based caches as they moved around. Truth sits behind it, centralized (perhaps partitioned in some way that makes sense globally but is sub-optimal from a regional cache perspective). Might not be worth it -- hard to know from here. :)
Re:The Uber Engineering Tech Stack, Part I: The Foundation by ajslater on Sunday July 24, 2016 @07:00PM (#12155358)
afaik, this is how Facebook does it, but with regional sources of truth. If you signed up for FB in Paris and move to San Francisco, your master profile lives in Europe in perpetuity and you'll use your regional cache forever in the USA. The number of people moving far away from their home DC's should be a reasonably small fraction of the total for it not to matter.
Re:The Uber Engineering Tech Stack, Part I: The Foundation by danpalmer on Sunday July 24, 2016 @09:32AM (#12153241)
As far as I'm aware, Hailo (>3 backend devs, not quite 100s) did exactly this as well, and the ex-Hailo devs I've spoken to considered it a pretty bad move. It took them ages to refactor into a global system if I remember rightly.
Re:The Uber Engineering Tech Stack, Part I: The Foundation by matthewrudy on Sunday July 24, 2016 @11:35AM (#12153561)
Yep, I had a long chat with one of their engineers (Matt Heath) and seems like they had the exact same problems we have.

And solved it with their restructure and move to microservices.

Re:The Uber Engineering Tech Stack, Part I: The Foundation by brianwawok on Sunday July 24, 2016 @08:04AM (#12153100)
If you are doing devops, wouldn't deploying to 1 data center vs 20 be no more work? It's just a loop around a script.
Re:The Uber Engineering Tech Stack, Part I: The Foundation by danpalmer on Sunday July 24, 2016 @09:33AM (#12153248)
All it takes is for one server in one datacenter to be slightly different, or perhaps you had a bugfix that needed to go out for users in one area, but you couldn't take the risk of a flaky deploy for the areas that didn't need it, now you've got a deploy that will be a lot more complicated or error-prone than a loop around deployment to one location.
Re:The Uber Engineering Tech Stack, Part I: The Foundation by brianwawok on Sunday July 24, 2016 @10:39AM (#12153428)
> All it takes is for one server in one datacenter to be slightly different

Don't do that. No one is allowed to ssh to boxes. If you need to enforce it by blowing up and rebuilding all servers once per week, do that.

> perhaps you had a bugfix that needed to go out for users in one area, but you couldn't take the risk of a flaky deploy for the areas that didn't need it

Feature flags. Default off, but flip on a new path of code for a set of users.

You should deploy so often that it is routine. Deploy 50 times a day. You will find bugs at first, but eventually you should get to the point that you could deploy for every single commit and no one would notice. (Now they may not be a good idea depending on your risk tolerance and other things, but you should be ABLE to deploy every single commit).

Not saying these are simple things to do, but if you are approaching servers with a devops mindsets, you literally should not care about number of servers or datacenters.

Re:The Uber Engineering Tech Stack, Part I: The Foundation by matwood on Sunday July 24, 2016 @11:08AM (#12153488)
> Don't do that. No one is allowed to ssh to boxes. If you need to enforce it by blowing up and rebuilding all servers once per week, do that.

Yep, this is change control 101. I used to have a boss who would go in and edit sprocs on the production server and never get them into source control. I finally just encrypted everything on the server so the only way to push out new code was to commit to source control. A sledge hammer yes, but sometimes it is required.

Use Terraform or some other tool to codify your entire infrastructure.

>You should deploy so often that it is routine. Deploy 50 times a day. You will find bugs at first, but eventually you should get to the point that you could deploy for every single commit and no one would notice. (Now they may not be a good idea depending on your risk tolerance and other things, but you should be ABLE to deploy every single commit).

This is a great point. At first it is terrifying, but then you realize that a deployment is so easy that bugs are generally not a big deal. Bugs happen, so the goal should be to shorten the time between bug found and fix deployed.

Re:The Uber Engineering Tech Stack, Part I: The Foundation by danpalmer on Sunday July 24, 2016 @01:03PM (#12153808)
> Don't do that. No one is allowed to ssh to boxes. If you need to enforce it by blowing up and rebuilding all servers once per week, do that.

I'd love to do that. I'd love to have no access to production servers, but ultimately that requires far more work to get right than Ansible configuring the same machines again and again. It also means you can't use dedicated hardware as easily, which restricts performance. It's a great situation to be in, but difficult to get to and requires a non-trivial amount of overhead.

At my place of work we deploy somewhere between 5 and 40 times on any given work day (on a team of 5 engineers). That's because we've managed to engineer a reliable and fast deployment process, but that took a long time to get right. It's powerful, but the overhead, particularly on a small team who are under pressure in a startup environment, can be quite large.

I'm not saying you're wrong, in terms of best practice I completely agree, but when the tradeoff is between sales/acquisition/product market fit/etc, and having a 'smooth' devops process, in many cases, the latter must come second.

Re:The Uber Engineering Tech Stack, Part I: The Foundation by brianwawok on Sunday July 24, 2016 @02:25PM (#12154171)
You can devops dedicated hardware. It's a little bit different but not that much. Heck there are boot2docker and such that let you just run docker on bare metal.
Re:The Uber Engineering Tech Stack, Part I: The Foundation by seanp2k2 on Monday July 25, 2016 @03:02AM (#12156981)
>docker >bare-metal

To some, no virtualization is still best.

Edit: you can still PXE boot immutable images.

Re:The Uber Engineering Tech Stack, Part I: The Foundation by brianwawok on Monday July 25, 2016 @08:16AM (#12158092)
I'm not sure boot2docker even has a virtualization level. Havent dug super far into it.
Re:The Uber Engineering Tech Stack, Part I: The Foundation by krinchan on Sunday July 24, 2016 @11:39AM (#12153575)
This is so weird. I hear this all the time. At my place of employment, we all have the ssh keys into our EC2 instances, but no one configures them. Ever. Period. Those ssh keys are purely for either validating changes in a test environment (like to .ebextensions) or diagnosing production issues (why did Puma fall over this time? why isn't syslog output making it to loggly?).

Of course, we lean heavily on Elastic Beanstalk; autoscaling regularly kills old instances daily since we scale from 2 to 18 and back to 2 instances in a 24 hour period across about 9 microservices.

So, if this ssh into boxes and change things is common, it means people aren't doing auto-scaling? THAT is scary.

Re:The Uber Engineering Tech Stack, Part I: The Foundation by brianwawok on Sunday July 24, 2016 @02:33PM (#12154213)
I'm very very pro devops. But I am cautious about auto scale.

It adds a lot of complexity. If your app has predprtable load it may simplify stuff a lot to not auto scale. Think a b2b app with manual account creation. You know your user levels. 0 reason to turn on auto scale.

Re:The Uber Engineering Tech Stack, Part I: The Foundation by krinchan on Monday July 25, 2016 @12:25AM (#12156459)
...so you run the servers you need for peak load 24/7? Ew. So much money just thrown away because "it's too complicated". We just scale based off of Network Out and only really spent a week finding the right threshold.
Re:The Uber Engineering Tech Stack, Part I: The Foundation by brianwawok on Monday July 25, 2016 @08:21AM (#12158123)
How long does your stack take to add a server. 3 minutes?

I have created a lot of services that couldn't have crappy perf for 3 minutes every time the load scales. Especially since in many apps the most expensive part is storage and dbs which cannot auto scale.

So say you spend 1k a month in your dbs and $100 for peak web load. You could spend a week fixing auto scaling bugs and try to save $25 by scaling web nodes down... But then you still have bad perf every time load spikes. I would not do that to save $25. I would question a company I work for that did that.

You need to be scaling up and down for hundreds of dollars per swing and have big spike loads before you add the complexity of auto scale.

Re:The Uber Engineering Tech Stack, Part I: The Foundation by krinchan on Tuesday July 26, 2016 @04:31PM (#12168538)
We're sensitive enough that we preemptively scale as traffic "appears" to be increasing. So we add 5 EC2 instances, not at crisis levels of traffic, but "Hmmm...I feel a tingling in my extremities". We then remove one instance at a time if traffic falls below "Not doing anything" levels. The time between scaling actions is 15 minutes. Since ASG's go to remove older instances first, we don't end up getting charged a full hour for instances that are up for less than an hour that often.

Admittedly, our web traffic is very US Business Hours centric and peaks predictably between 3 and 4 in the afternoon.

Also, we're operating more at a scale of $40,000/month for peak traffic capacity 24/7 and $25,000/month once I got autoscaling worked out. So...yeah. I guess the scale for savings matters. :-)

Re:The Uber Engineering Tech Stack, Part I: The Foundation by icebraining on Sunday July 24, 2016 @09:38AM (#12153258)
All it takes is for one server in one datacenter to be slightly different

But doesn't a global system still run on multiple DCs, at least for redundancy?

perhaps you had a bugfix that needed to go out for users in one area, but you couldn't take the risk of a flaky deploy for the areas that didn't need it

But if you have a single global system, you can't even make that decision.

To be clear, I'm not arguing against it, I'm just trying to understand why, since my first instinct would be to divide geographically as well.

Re:The Uber Engineering Tech Stack, Part I: The Foundation by danpalmer on Sunday July 24, 2016 @09:51AM (#12153295)
> But doesn't a global system still run on multiple DCs, at least for redundancy?

If you've got 2 levels of separation - servers and 'groups' (whether they are datacenters, or whatever) - you've got 2 levels at which that special casing needs to happen. If you only have 1 level - servers - i.e. one deployment, even if that's across multiple datacenters, you only have 1 place to special case. I'd say that's easier.

> But if you have a single global system, you can't even make that decision.

Good point, but my point was that it will be simpler and less error prone in general. You might not be able to push the bugfix, or you might have to risk the deploy globally, but I think either would be better in the long run for a simpler deployment. It is a trade-off though.

Re:The Uber Engineering Tech Stack, Part I: The Foundation by matthewrudy on Sunday July 24, 2016 @02:09PM (#12154103)
There's the other aspect too, which is each country has their own cluster, so they can (and do) think of excuses to hold back updates just for them.

So software gets out of sync, the mobile app releases need to take that into account too.

Re:The Uber Engineering Tech Stack, Part I: The Foundation by BenPlanetary on Sunday July 24, 2016 @10:36AM (#12153420)
Your user accounts aren't global? So does that mean if I travel to a new city I have to create a whole new account?
Re:The Uber Engineering Tech Stack, Part I: The Foundation by matthewrudy on Sunday July 24, 2016 @11:37AM (#12153566)
Surprisingly although we have user accounts implemented, most of our customers don't use them.

But yes, as it stands, if you create a user account it is distinct per country.

Re:The Uber Engineering Tech Stack, Part I: The Foundation by praneshp on Sunday July 24, 2016 @12:47PM (#12153772)
Why would having federated logins be difficult to implement?
Re:The Uber Engineering Tech Stack, Part I: The Foundation by matthewrudy on Sunday July 24, 2016 @02:07PM (#12154091)
It's just not important enough to do.

Startup resources, business priorities, customer behaviour...

Re:The Uber Engineering Tech Stack, Part I: The Foundation by dbbk on Monday July 25, 2016 @11:02AM (#12159132)
Surely customers travelling to new cities/countries they don't know is significant behaviour?
Re:The Uber Engineering Tech Stack, Part I: The Foundation by steven2012 on Sunday July 24, 2016 @11:36AM (#12153565)
I've traveled to a dozen cities with Uber and didn't have to change my account, even in China. So the answer is no.
Re:The Uber Engineering Tech Stack, Part I: The Foundation by dbbk on Monday July 25, 2016 @11:01AM (#12159128)
They said they were an Uber-like system, not Uber itself.
Re:The Uber Engineering Tech Stack, Part I: The Foundation by uola on Sunday July 24, 2016 @06:26AM (#12152922)
"Yet that's what has to work well to beat the competition, which is taxi dispatchers with paper maps, phones, and radios."

In some part (maybe even a large part) of the world, yes. But in markets where taxis are from different companies (or in other ways make ordering one in advance more common) already has fairly sophisticated technology. Let's not promote the myth of startup exceptionalism. Uber has modern (but not futuristic) technology, but the real difference is in the business model.

Re:The Uber Engineering Tech Stack, Part I: The Foundation by zer0gravity on Sunday July 24, 2016 @04:19AM (#12152696)
You know that saying : "I didn't have time to write a short letter so I wrote a long one".

With this kind of technology stack you end up when you try to move fast. I'm sure that if more time and thought would have been put into it, it would have been more elegant and simple. But has time these days ?

Re:The Uber Engineering Tech Stack, Part I: The Foundation by chiph on Sunday July 24, 2016 @09:52AM (#12153297)
I had similar thoughts. "Wow. All those moving parts. Each one of which could fail." Each new piece of unique technology added means that it's probability of failure gets multiplied against what you already have.
Re:The Uber Engineering Tech Stack, Part I: The Foundation by carterehsmith on Sunday July 24, 2016 @11:22AM (#12153523)
According to the article, this is not their first take at the architecture. There are links that point to their older setups.

So the current architecture is what they came up with after some time and some thought have been put into.

Re:The Uber Engineering Tech Stack, Part I: The Foundation by daniel-levin on Sunday July 24, 2016 @04:38AM (#12152732)
Well, to some extent, they do. Their geofencing [0] service takes in coordinates and returns the geofences these coordinates fall into. They make this faster by pruning irrelevant geofences:

>> Instead of indexing the geofences using R-tree or the complicated S2, we chose a simpler route based on the observation that Uber’s business model is city-centric; the business rules and the geofences used to define them are typically associated with a city. This allows us to organize the geofences into a two-level hierarchy where the first level is the city geofences (geofences defining city boundaries), and the second level is the geofences within each city.

[0] https://eng.uber.com/go-geofence/

Re:The Uber Engineering Tech Stack, Part I: The Foundation by asdfaoeu on Sunday July 24, 2016 @03:17AM (#12152581)
> We assign cities to the geographically closest data center, but every city is backed up on a different data center in another location.
Re:The Uber Engineering Tech Stack, Part I: The Foundation by matthewrudy on Sunday July 24, 2016 @05:40AM (#12152833)
I tried to debug this from Hong Kong, and the API calls definitely go to the US.

Maybe in Europe they resolve to a European data center, but in Asia they still seem to send everything via the US.

Re:The Uber Engineering Tech Stack, Part I: The Foundation by taxicabjesus on Sunday July 24, 2016 @09:59AM (#12153317)
> Yet that's what has to work well to beat the competition, which is taxi dispatchers with paper maps, phones, and radios.

Large taxi companies started to switch to GPS-enabled electronic dispatch systems at least 12 years ago.

Re:The Uber Engineering Tech Stack, Part I: The Foundation by mooted1 on Sunday July 24, 2016 @11:19AM (#12153516)
Sharding your application geographically is a quite a bit of complexity and requires a lot of work developing support infrastructure to manage load balancing, failover, and placement. One of the advantages of SOA is that different services can have different architectures.

To be precise, we do do geographic sharding in the services that benefit from it, but avoid it in the services that don't.

Also note that the assumption of region based partitioning doesn't extend to all applications. Analytics, for example, may want to dice and slice the data along different dimensions. Partitioning is a convenient abstraction for managing marketplace scale, as you mentioned, but inconvenient elsewhere :).

Re:The Uber Engineering Tech Stack, Part I: The Foundation by jdavis703 on Sunday July 24, 2016 @11:18AM (#12153511)
Riders and drivers are also not local. I travel a lot and yet my star rating, profile picture and payment details work regardless of if I'm in the Bay Area, Berlin or DC. Further I've heard of Uber drivers giving rides to other regions, e.g. SFO airport to Sacramento (apparently fairly common as the Sacramento airport has limited service and is expensive).
Re:The Uber Engineering Tech Stack, Part I: The Foundation by golergka on Sunday July 24, 2016 @06:22AM (#12152917)
> Facebook originally tried to do that, then discovered that, as they grew, friends weren't local.

Interesting. Do you have a link on that?

Re:The Uber Engineering Tech Stack, Part I: The Foundation by stygiansonic on Sunday July 24, 2016 @07:11AM (#12153017)
Basically, it was a way to partition users as some form of horizontal scaling. See these two Quora posts:

https://www.quora.com/How-did-Zuckerberg-code-Facebook-so-fa...

https://www.quora.com/In-what-order-did-Facebook-open-to-col...

Re:The Uber Engineering Tech Stack, Part I: The Foundation by Animats on Sunday July 24, 2016 @03:17PM (#12154405)
EE380 talk at Stanford with Facebook devs. They were there to talk about their PHP compiler, but got into how Facebook scales.
Re:The Uber Engineering Tech Stack, Part I: The Foundation by nl on Sunday July 24, 2016 @07:05AM (#12153009)
Yet that's what has to work well to beat the competition, which is taxi dispatchers with paper maps, phones, and radios.

Taxis are a only part of the picture.

Logistics is where the money is. Logistics is where network effects are important.

FedEx doesn't use paper maps.

Re:The Uber Engineering Tech Stack, Part I: The Foundation by afarrell on Sunday July 24, 2016 @05:06AM (#12152784)
Why would Uber/Lyft use be localized? I tend to use it far more when in an area where I'm unfamiliar with the local transit network.
Re:The Uber Engineering Tech Stack, Part I: The Foundation by imaginenore on Sunday July 24, 2016 @05:10AM (#12152791)
But you are local to that unfamiliar area when you search for a ride. That's what they mean.