Created this User CSS to make reddit look more like Hacker News.
Created this User CSS to make reddit look more like Hacker News.
I didn’t know about this. Going to turn it on in Springpad’s Android build and see what happens.
StrictMode.setThreadPolicy(new
StrictMode.ThreadPolicy.Builder()
.detectDiskReads()
.detectDiskWrites()
.detectNetwork() // or .detectAll() for all detectable problems
.penaltyLog()
.build());

At Springpad the development team has spent a lot of time setting up our local environments. The setup includes:
We documented the ever changing setup. We wrote shell scripts to automate the process. For Python we switched from shell scripts to Fabric. In the end though it still felt cumbersome to get a new environment setup for development.
VirtualBox
We realized just a few months back (we are probably late to the game) that we could setup the entire stack in a VirtualBox instance. Not only that, but we could locally run our services exactly as they run in production, on a Debian distribution. We are now setting developers up with:
Nice Benefits
So I definitely would recommend checking out VirtualBox if you want to simplify your local development environment.
Really liking the new monitor arm for the LCD. It swivels, extends/retracts, rotates, and has a really nice look.
Pycharm OSX install graphic
When we started working with Cassandra we experimented with different Java and Python clients. While they all supported the required APIs, and they each added their own sugar on top, not all of them had thought through how to architect a client in a way that matched the power of Cassandra itself. A backend service, whether it is SOLR, memcached, Redis, or Cassandra, is only as good as the client libraries available.
Connection management
Logging/Operations
It is actually pretty hard to get all of this right. Why start from scratch though. Take a look at Hector or Telephus for Cassandra, or java-memcached-client.
Here is a useful snippet we use when working with twisted. It is nice to be able to just decorate a method with a timeout.
Some of the backend systems that springpad uses are being written in Python and use Twisted. Twisted, tornado, eventmachine, netty, are frameworks that ease development of services that want to take advantage of non-blocking IO. Instead of scaling via more threads, or more processes, that are IO bound, the frameworks make use various techniques to enable asynchronous notifications when IO is available.
For Springpad, this makes a ton of sense. We connect to a large number of 3rd party services. Amazon, Yelp, Google, Pricegrabber, Netflix, and more. We can’t control the response time of these services, and dedicating threads to just wait for responses can be expensive.
When I read online about these frameworks, I generally find information about how they can scale to thousands of connections, can be used to implement real time services, how one is better than the other because it can handle yet another couple of hundred connections, how threads can actually outperform async IO under certain conditions. What I don’t generally see people talking about -
Async IO can remove the need for threads
In many cases async IO can remove the need for threads in your application. Thread programming can be difficult. Many libraries are not thread safe (Java SimpleDateFormat, many python libs) and so you have to be very defensive. Some people are very good at it, but there is plenty of evidence to suggest that getting multithreaded programming right is hard. I personally have been enjoying switching my mindset to single threaded. That said, async IO is still concurrent. You still have to be careful when dealing with shared state.
Many web 2.0 services are IO bound
Many services spend a great deal of time talking to APIs outside of their control. Threads can be expensive, and hard to work with, when all you are trying to do is fetch some data from a web service. Internal queries to databases, nosql stores, memcached, all generally end up being IO bound. Springpad has code that fetches >100 items at a time from memcached and/or Cassandra.
The Debate
So sometimes I think that the debates about the need for, or the performance of, async IO frameworks, are missing a key part of the positive argument. There is inherent value in them in that the can lead to cleaner code with fewer bugs, while at the same time probably increasing scalability quite a bit.