Why We’re Switching to Node.js

At Crittercism, we are now a post Series A company with a great crash-reporting and app monitoring product that many developers are currently using. A challenge that we’re currently tackling is scaling our backend to efficiently accommodate many more apps with potentially large numbers of users. We’re accumulating terabytes of data, so speed in querying, updating, and inserting data as fast as possible is a big technical challenge. Our backend until now has run on Pylons (using Python), but we’re switching over to Node.js.

A huge advantage of Node.js is that it is asynchronous (or non-blocking), compared to Pylons, which is synchronous. This can significantly speed up processing of  I/O bound requests. These requests occur when data read/writes take significantly more time than computations. How will this help us here at Crittercism? Most of our traffic comes in the form of reporting app loads, crashes, and handled exceptions. Most of the time spent processing these requests is during insertion of data, making it I/O bound. Node.js will allow our servers to take an incoming request, perform the necessary computations, send a command to update the database, and move on to the next request in the queue without waiting for the database update to complete. Requests to third-party APIs can also be treated similarly.

We briefly considered Tornado (an asynchronous Python framework), but ultimately decided Node.js would work best for us. All libraries compatible with Node.js are asynchronous, however, this is not necessarily the case with Tornado. In addition, the community surrounding Node.js is growing quickly, which will be beneficial in the future. In addition, as more developers face similar challenges, more libraries are being developed that will increase capabilities for reference points. With all of this in mind, we’re excited to start using Node.js to grow Crittercism. We’ll benchmark and report on the performance benefits through a series of follow-up posts. More to come….

Author: Justin Helbert, Amazing Crittercism Intern

Packaging Android Libraries with Native Code

We recently announced support for crash reporting for bugs in native code built with the Android NDK. Creating this new product came with a set of challenges, one of which was determining how best to integrate this product into your amazing mobile apps.

The goal was to design a library for native code that was as painless to integrate as our SDK library; a single line of code. In order to build this clean user interface to our library, we set out to package all of the code into a single .JAR file. Unfortunately, the Android system makes this a little more difficult than it probably should be.

Including a .JAR library in your Android project is really as simple as pasting the file into the libs directory in your project.* On build time, the contents of the .JAR are combined with that of your project into the APK primarily by mapping the contents of the directories together. For example, the files in the /assets directory of the .JAR will appear to the build system as being in the /assets directory of the application.

When you build native code for an Android application with the NDK build tools, it places the compiled binary object files in the /libs/<eabi>/ directory. At build time, these files are mapped into the /lib directory in the APK. Upon installation, the proper .so for the hardware is extracted into /data/data/<app dir>/lib/ directory on the device. To load this library in order to call native methods from Java, one simply calls:

System.loadLibrary(“<lib-name>”);

This searches the libs directory for the library <lib-name>.** This system is straightforward, and for the normal use case, quite seamless. The native libs get put into the lib directory in the APK and are automatically extracted.

In order to have the native library in the .JAR library included and extracted the same way, the obvious choice would be to place the native libraries into the /lib directory in the .JAR so that they will be built into the lib directory in the APK and end up in the application’s lib directory on the device. All this works fine until the actual install when you are prompted by the following error in eclipse:

This error occurs because the device detected native code in the .JAR that was to be placed into the application’s lib folder. This error is extremely frustrating because the fact is that my .JAR contains native libraries that will actually run on the device. According to a post in the Android NDK Google Group by the Android SDK Tech Lead,

“We added that because we’ve seen people include jar that contains native code compiled for windows/mac/linux. We should at least check that it looks like a proper Android native library and just output a warning. I’m afraid there’s no work around, you’ll need to manually add the library to the project that includes the jar file.”

He proposes that instead of packaging the native library in our .JAR, we include it separately and have developers, in addition to copying the .JAR file into their project, also copy the native code into the libs directory of their project. While that would be a reasonable solution, we felt that it unnecessarily complicated the inclusion process and added room for error.

Instead, we devised a strategy to avoid this check by packaging the native library as an asset of the .JAR file. Then we detect whether the library exists on disk. If it doesn’t, we grab the library from assets (Context.getAssets().open()), and extract it to the filesystem. That way, we can load the library easily using the more generic System.load() function that takes a complete path rather than just a library name. This way we are able to seemlessly package our native code into the .JAR and avoid the fatal error shown above.

I’m not sure that this is the cleanest solution from our perspective, but it has proven to be a satisfactory solution for our needs. It uses no extra disk space by including the native library directly. While there is an extraction at runtime rather than at install time, it takes place just once, the file being extracted is small (<100kb), and all of this happens in an auxiliary thread. Most importantly, packaging our library this way creates a simple and seamless experience for the developer.

*<property name=”jar.libs.dir” value=”libs” /> is set in /tools/ant/main_rules.xml by default but you can change the jar.libs.dir in your .properties files for ant.
**When you build it with ndk-build, lib- will be appended to the name and when you load the library you don’t need the lib-

Author: Andrew Werner, Crittercism Intern Extraordinaire

Join The Critters at the Mobile Monday Mixer!

Where: Pedro’s Cantina
128 King Street (at 2nd Street)
San Francisco, CA 94107

When: Monday, August 20: 6pm-9pm

RSVP HERE!

Mobile Monday Silicon Valley is hosting a mobile mixer this month in San Francisco sponsored by Crittercism, Apsalar, and Lyft.

Join fellow mobile enthusiasts for an evening of food, drinks, mixing, and mingling!

Come early while food and drink last.

Mobile Monday is Silicon Valley’s premiere mobile networking and authority for the mobile entertainment industry. Come network with industry executives and hear Mobile leaders speak about compelling issues surrounding market strategies, current trends and revenue generating momentum in the Mobile Industry.

Food and drinks are sponsored by:

crittercism

apsalar

lyft 

Here’s Why Our Interns Rock at Crittercism

Hi, my name’s Dan and I just finished my ten-week internship at Crittercism. I thought it was awesome, and here’s why:

1. The Critters are great to learn from and fun to work with.

The work environment was very open and playful (Nerf Guns galore). When I started, there were a ton of technologies that I had to get up to speed with, and this environment was exactly what I needed. I could always ask anybody a question, or share my input about a problem.

2. Interns are people too.

This might be true for most startups, but it’s still worth emphasizing that at Crittercism, the interns do real work. In fact, some of the biggest features released this summer were built in large part by interns! Most of my time was spent working independently on a large project from scratch with full freedom to focus on my strengths. I think the amount of trust given to the interns says a lot about the Critters and helps to build a great team.

3. Growth is exciting.

I never expected to see significant growth in volume in only ten weeks. Boy, was I wrong! Let’s just say that our server graphs are using completely different scales than they were when I started. Although I didn’t directly work on web scaling, I got to watch and learn from experienced engineers as they tweaked the system. Our infrastructure is unique because it needs to support millions of new users that are simultaneously activated (when a popular app integrates our service). As you might expect, this can lead to some very exciting workdays!

Thanks for a great summer. I’ll miss you guys.

Crittercism Announces the Winner of the Good vs. Evil Hackathon

MobDeck is like your billboard music chart for mobile apps. This cool new productivity app provides an easy way to monitor the top performing apps in the iOS and Android marketplaces. In addition, MobDeck tells you how many weeks an app has been on the chart, if it’s already in your Salesforce CRM, who on your team is currently assigned to it, and the link to their LinkedIn company profile.

Image

Good vs. Evil Hackathon at Crittercism Labs

Will your app make the world a better, more productive place like Astrid? or will it drag the world down into a place where cute cats and farm animals rule?

YOU CHOOSE THE ADVENTURE.

Hack on the good (productive) or the evil (counterproductive) side. Awards for the best good and evil app will be rewarded accordingly!

Hacking begins at noon on Saturday, August 4th and hacks will be presented at 3pm on Sunday, August 5th.

On Saturday night, Tim Su, co-founder of Astrid will give a short talk on his experiences going through the AngelPad incubator program and raising money from Venture Capitalists and angel investors.

Crittercism Labs
300 Brannan St
Suite 308
San Francisco, CA 94107

RSVP HERE: http://bit.ly/goodbadhackathon

Follow

Get every new post delivered to your Inbox.