News for hackers. Stuff that matters.
Re:How We Built Uber’s Highest Query per Second Service Usin... by Animats on Tuesday March 01, 2016 @04:50PM (#11206378)
It's interesting that they're doing a spatial database without using a 2D spatial data structure. MySQL and PostGres both have data structures for this. But maybe they don't have that many geofences per city.

They have an N readers, one writer problem. It's possible to do that without blocking the readers. There was a YC article on a lockless solution to that yesterday. This is an easier problem. Each city's geofences can be updated by making a copy, updating the copy, and atomically replacing the single reference to the copy. Any searches still running on the old copy continue to run on the old copy. Eventually, the GC deletes the old copy.

Re:How We Built Uber’s Highest Query per Second Service Usin... by code_research on Tuesday March 01, 2016 @06:00PM (#11206831)
I did a quick search for "lockless" on HN, bugt could not find the article you are referring to - would you like to post the link? Thank you!
Re:How We Built Uber’s Highest Query per Second Service Usin... by spyspy on Tuesday March 01, 2016 @06:23PM (#11206969)
I believe that's exactly what they were doing with the StorePointer/LoadPointer primitives. However it is generally agreed in the Go community that the sync/atomic is to be avoided in favor of the sync/mutex for this type of problem. The RWMutex is designed for a 1 writer/N readers scenario. The code is more readable and you don't offload any work to the GC.
Re:How We Built Uber’s Highest Query per Second Service Usin... by pcwalton on Wednesday March 02, 2016 @03:46AM (#11208806)
> However it is generally agreed in the Go community that the sync/atomic is to be avoided in favor of the sync/mutex for this type of problem.

Why? Concurrent data structures are extremely useful.

> The code is more readable and you don't offload any work to the GC.

You shouldn't write concurrent data structures yourself; you should use a library. And the amount of time spent in the GC for this is going to be negligible assuming writes are infrequent compared to reads. It's rare in a GC'd language that your write operation won't be creating garbage somewhere along the way, so it ends up being amortized.

Re:How We Built Uber’s Highest Query per Second Service Usin... by azth on Tuesday March 01, 2016 @08:21PM (#11207527)
> There was a YC article on a lockless solution to that yesterday.

Which one are you referring to?