Harish Mallipeddi RSS

Avid Pythonista with a secret love for Erlang.

harish.mallipeddi at gmail

 Photos

 LinkedIn

 Twitter

 Projects

Older posts

Feb
25th
Thu
permalink Comments
Feb
22nd
Mon
permalink Comments
Feb
19th
Fri
permalink
The spot price of MicroSD cards is nearly identical to the spot price of the very same NAND FLASH chips used on the inside. In other words, the extra controller IC inside the microSD card is sold to you “for free”. Incorporating the controller into the package and having it test, manage and mark bad blocks more than offsets the cost of testing each memory chip individually. A full bad block scan can take a long time on a large FLASH IC, and chip testers cost millions of dollars. Therefore, the amortized cost per chip for test alone can be comparable to the cost of silicon itself.

On MicroSD Problems «  bunnie’s blog

Fascinating article on the MicroSD industry and the economics involved in manufacturing them by a Chumby engineer. He has a whole series of articles about hardware manufacturing and China.

Comments
Feb
18th
Thu
permalink Comments
Feb
10th
Wed
permalink
REPLACE INTO Tickets64 (stub) VALUES (‘a’); SELECT LAST_INSERT_ID();

Ticket Servers: Distributed Unique Primary Keys on the Cheap - Laughing Meme

Kellan describes the hack they use at Flickr to (atomically) generate globally unique auto-increment ids across shards. Redis would be great for something like this.

Comments
Jan
16th
Sat
permalink Comments
permalink Comments
Jan
3rd
Sun
permalink Comments
Dec
20th
Sun
permalink Comments
Dec
15th
Tue
permalink Comments
Dec
13th
Sun
permalink Comments
Dec
4th
Fri
permalink

How node.js exposes traditional blocking I/O calls in a non-blocking manner

If you’ve not heard about node.js, do watch the video from a talk given by Ryan Dahl (project lead) at JSConfEU 2009.

The thing which I found most interesting is how he handled the shortcomings of libraries like eventmachine. eventmachine is great for building highly-scalable single-threaded network servers using async network I/O. But while writing your network servers, you’ve to be careful not to introduce some blocking calls in your event callbacks. Since your server is single-threaded, if you block inside the event callback then you’re basically not handling any of the other incoming requests during the time that the thread was blocked. Why would you need to do blocking calls? Your MySQL client library will typically do blocking I/O. POSIX filesystem calls are blocking. There are many other such instances where the usefulness of eventmachine is reduced. So in node.js, Ryan has decided to wrap away these blocking APIs and expose them in Javascript in a non-blocking manner - basically a batteries-included arsenal of non-blocking APIs in one package if you will. Take a look at the node.js API docs to get an idea of the kinds of things that are supported.

The way node.js works underneath is that it offloads all the blocking calls to a thread-pool and when the calls finish, the results are fetched by reading off a pipe to which the threads write to. Incidentally pipes are select()-able which means these events can be handled within the main event loop of node.js in exactly the same manner as the other network socket events. I quickly implemented a barebones proof-of-concept of this idea in Python:

Note - if you’re reading this via a RSS reader, open this in a browser to see the gist code embed above.

Comments
Dec
1st
Tue
permalink

Tumblr backup tool in 40 lines of Clojure

The code doesn’t necessarily do a lot of error handling.

Note - if you’re reading this via a RSS reader, this blog post contains a Gist embed; open the page in your browser.

Comments
permalink Comments
Nov
26th
Thu
permalink Comments