What I’ve learned from SwiftScore 2017

ProgrammingSchoolSociety

Although I did not take any AP exams this year (because I am taking college classes instead), the previous two years of AP score release were nerve-wracking and I could empathize with those who could not bear to wait a second further without spasming and relapsing into full-blown bleach chugging.

Okay, I’m kidding about the bleach. But the nervousness/anxiety is certainly relatable and I just couldn’t stand others being left in the dark due to their physical location.

So here is what I did. I used EarlyScores’ source code (written in PHP) and starting a “mirror” with a different name. This helps to reduce traffic on other score checkers (which is good, considering they get so overloaded), allowing everyone to check their scores as efficiently as possible.

On the days preceding AP Score Release 2017, I spinned up a 512MB DigitalOcean droplet and used a $15 credit I found online to reduce the costs down to nothing. The cost was only $0.007/hr, so I ended up spending less than $1.50 for a server than ran for like a week or less. I figured this would be fine. Then, I posted the details on Twitter and asked people to share. Retweets did occur before the day of score release, but there were especially a lot on score release day. A good chunk of traffic came from Twitter, followed by Reddit (advertising on r/APStudents). Direct sources were word-of-mouth spreading, which was surprisingly popular. I talked with someone from China, who said they were referred by their WeChat group.

All was ready.

On the morning of, I woke up at 6am CDT (all times from here on out will be in Central Daylight Time) to see if CollegeBoard had released the scores early. Nope. I was getting worried that they had blacklisted our IP addresses. Thankfully, that was not the case. Even though I had no news to expect, I was hoping for the best. Hopefully this would work.

Around 8am, the floodgates were opened by CollegeBoard and score checking began.

Our website immediately began timing out. For an hour, I was frantically scrambling around, trying to get it to work. The website kept timing out. I thought perhaps the code got screwed up somehow? No, that wasn’t the issue.

 

Around 9am (too late unfortunately), I deployed a secondary server and that helped get people flowing. Next time, I will be sure to deploy several servers, or better yet, use a Node.js-based solution instead to handle traffic much better and so we can have a message queue system instead of a everybody-try-at-once-and-everyone-fail-at-once system.

At 11am, I deleted the secondary server and reverted back to the first server.

Believe it or not, traffic actually peaked around 11am that day; the server had began to operate very smoothly beginning around 9:30am. This means that the primary issue with scalability does not lie in people accessing SwiftScore, but rather SwiftScore accessing CollegeBoard’s AP score checking website. Since the same server handling people’s requests also handled the score checking, this didn’t go too well in the beginning. However, as overall CollegeBoard AP score demands slowed down, SwiftScore began to function better. Hence, Node.js would’ve been better. Note that there is not much we can do about the CollegeBoard website crashing; at the end of the day, score retrieval uses a scraper and there’s simply no more efficient way to gather data.


A major issue with EarlyScores’ underlying scraping mechanism is that it doesn’t support “Can’t find your AP scores” issues, “Fill out your AP Profile” prompts, and “Accept the CollegeBoard Terms and Conditions” dialogs, the latter being the most common reason someone emailed me asking for manual score checking. I ended up implementing a T&C acceptance dialog in SwiftScore’s codebase and committed the code to EarlyScores’ codebase out of courtesy and gratitude.

Oh yes, and nobody cared about SwiftScore until actual score checking day. But this image below might change your mind.
Ah yes, that’s money. Holy crap, this earned a bunch of profits. I innocently ran an AdSense ad on the website, hoping for it to earn a few bucks. I didn’t imagine it’d actually generate this much money. And I didn’t spend a cent on server costs. And yes, I used the cheapest possible DigitalOcean droplet there is.

This has taught me an important lesson: monetizing the first hour requires a much more complex system (cough cough Node.js and message queuing), but after that, such a small-scale system is actually enough to process 50,000 requests spread out over a few days.

Out of gratitude for the amount of support shown to me by people from my former high school, I am pledging most of this AdSense payout to worthy causes in my former high school (except for the Living Roof Project—I’m sorry but this would only be a drop in a bucket), so if you’re from Boyd (GO BRONCOS!!!) and you have a good reason to use $50, and $50 would be significant, I’m donating this money to you. The rest is reserved for future SwiftScore costs of operation, including possible ad-free servers.

And a thank you to EarlyScores.com and my friends who have supported my efforts. I hope to help again next year!

 

Previous
SwiftScore 2017
Next
Hackathons: are they really worth it?