Features & Updates

Why we're Moving off Apps Script

If you’re a current user of Gmail Meter, you are might know that this month we got a bit more practice apologizing than we anticipated, and if you’ve contacted us about the error messages, you’ll know that these messages that a good portion of you have received are almost completely out of our control.

That may not seem like the best response to these inquiries, so I wanted to take some extra time to explain what exactly is going on here.

Google Apps Script and Gmail Meter

The current version of Gmail Meter is built off of the Apps Script platform, which is a scripting language maintained by Google designed to let a user to integrate different Google Apps services together. Basically, it lets the various Google services talk to each other much better, which is obviously helpful for the end user.

With Gmail Meter, a user’s Gmail usage data is collected and compiled within that user’s Drive storage, making Google Apps Script the ideal language to build the initial version of our tool. Beyond being hosted within Google’s App Script architecture, which requires very little in terms of setup from our end, another added benefit is the simplicity of moving a user’s data from one Google service to another.

This platform has served us well for a number of years, but we have realized a few limitations in the last couple of months. Instead of going into detail about every minor limitation, I want to focus only on the major problem, which is that Apps Script is hosted on proprietary Google Apps Script machines as opposed to the standard Google Compute Engine machines. While this simplifies many maintenance and backend operational needs, this also sacrifices a lot of fine grain control. Without that control, we are unable to provide you with the best user experience possible.

So what does this have to do with the error messages?

Over the course of the last few of months, we noticed a significant increase in the number of users who reported receiving some kind of timeout error. Typically, the email would include a message along the lines of “Exceeded maximum execution,” which in layman’s terms means that the Gmail Meter script took so long to run that the server killed the script.

Unsure of the reason for the sudden jump in these error messages, we spent some time investigating what could be causing our script to timeout. After review, we realized that there was a major flaw in how we had programmed the script to be run. The Gmail Meter script is programmed to turn on once a day for each user, but due to an oversight, every user’s script was set to run within the same 30 minute period every day.

Obviously with thousands - tens of thousands, actually - of scripts running simultaneously, some timeout errors are to be expected. The decision to optimize was made quickly.

We created an algorithm that spaces out the running of the script for our users throughout a 24 hour period. Instead of having a maximum of fifteen thousand scripts running at the same time, all users were spaced out evenly throughout the day, with only a maximum 200 or so scripts running simultaneously within the same minute.

After implementing this load balance, we saw way more support tickets reporting this error message than ever before because this is how software development works.

Having no clue what we did wrong and after spending another countless number of hours investigating, we finally came across this known Google Apps Script issue. It’s difficult to explain the strange combination of emotions we felt when we first saw this. There’s the relief knowing that we hadn’t done anything wrong coupled with the helplessness knowing that there’s a systemic issue within the platform that we’ve built our product out of.

We’re not the only company that has experienced this issue, nor is Gmail Meter the only application that is currently affected. We’ve reported our experiences within that open ticket, and have also exchanged emails directly with Google employees about the specifics of the issue.

Unfortunately, even though there have been many reports of the same error, the only definitive answer we’ve received from Google is that they are still unable to replicate this issue.

Looking forward to a new Gmail Meter

With that said, we did ultimately implement a workaround to prevent these error messages from being triggered. Unfortunately, the only way to do so was to slow down the script and severely limit how fast it processes through emails. To be clear, we’re talking about reducing the speed by a factor of a quarter of what it was a couple months ago.

It should be no surprise to anyone then that we have since made the decision to move Gmail Meter off of its current Apps Script platform. While this unfortunately means that we will provide less technical support for this legacy version of our tool, this does mean that we will be bringing you a much better version of our Gmail analytics tool much quicker than previously planned.

As always, please feel free to subscribe below or follow us on Twitter to stay up to date on our development progress, and please don’t be shy about emailing us with questions or concerns using our info@gmailmeter.com address.

Thanks for reading and I look forward to the next update!