Why every millisecond counts for e-commerce sellers during Black Friday/Cyber Monday
by
November 23, 2023Please note: This blog was originally published in 2020. It’s since been updated for accuracy and comprehensiveness.
When your customers are buying online, every millisecond matters. Every 1,000 millisecond or 1 second reduction in page load time for Walmart resulted in a 2% conversion increase. Every 100 milliseconds for Mobify resulted in a 1.11% conversion increase. Especially during peak times like Black Friday/Cyber Monday, you don’t want your customer to abandon their purchases because your page load time was slow.
At TaxJar we take speed seriously. On average, our sales tax calculations API endpoint is more than 16 times faster than our closest competitor. See for yourself on our status page.
Sales tax calculations also have to be accurate and reliable. As a merchant your sales tax API is mission critical. If it goes down you’re not collecting sales tax from your customers. And if you’re not collecting sales tax from your customers, you’re going to pay that sales tax out of your pocket when it comes time to file.
We guarantee 99.99% uptime and provide backup tax rates just in case. Our competition commits to a minimum service uptime of 99.5%.
Over 1 day of downtime a year is not acceptable. Combined with higher response times, your sales tax API alone could be costing you tens of thousands of dollars a year in lost revenue.
Try TaxJar for free
TaxJar offers one platform to manage every aspect of sales tax compliance from calculations to reporting to filing. Try our sales tax compliance platform for 30 days, completely free with no obligation.
Get startedTaxJar’s API migration from Ruby to Elixir
In 2018, our engineering team made the strategic decision to begin migrating our Ruby API endpoints over to Elixir. By August 2019, 100% of our sales tax calculations were running on the industrial-strength, high-performance, and fully distributed Erlang VM.
Elixir is a functional, concurrent programming language that allows us to leverage the scalability of Erlang. WhatsApp uses Erlang to reach over two million concurrent users on a single node. AdRoll uses Erlang to process 500k+ bid requests per second. TaxJar uses Erlang to perform hundreds of millions of sales tax calculations a month for entire platforms and Fortune 500 companies. At the same time, we brought down our AWS server costs substantially.
TaxJar used a canary release strategy by directing a subset of traffic to the new Elixir endpoints and the remaining traffic to the older Ruby endpoints via Amazon API Gateway. We gradually increased the number of API calls made to Elixir over time until we were confident in handling 100% of API requests with Elixir on production.
To gain that confidence, we designed an internal project known as Kodan to replay millions of historical API requests through our new Elixir API using Amazon Athena. This allowed us to discover edge cases and unexpected scenarios that may have resulted in different behavior compared to our Ruby API. Our goal was to ensure full parity between both APIs on how they receive and process incoming requests. Kodan made it possible to catch these differences before they affected any users on production.
Handling requests identically between the APIs led to some interesting challenges along the way. One was duplicating Ruby’s permissive type system inside Elixir. Ruby allows for many different implicit conversions (e.g. `“”.to_f == 0`) that you won’t find in Elixir. Another challenge was mirroring the sorting behaviors found in Ruby so the ordering of line items and other collections of data in a response remained consistent.
Overall, the transition from Ruby to Elixir went smoothly. It required a shift in thinking to write code in a functional way, but it made testing that code much simpler. Elixir’s functional nature allows for very small, isolated units of change and it gave us confidence that other areas of our codebase wouldn’t be affected. Pattern matching helped us write cleaner code in our complex validation layer that was once encumbered by conditional statements in Ruby. The language features of Elixir that are just under the surface like the `with` statement, protocols, and behaviours improved our productivity.
As a result of switching from Ruby to Elixir, our average response times decreased from 75ms to 18ms. Infrastructure and server costs were dramatically lowered. When Black Friday and Cyber Monday rolls around, our API doesn’t break a sweat. TaxJar’s API is built to power entire e-commerce platforms and marketplaces. It’s built to last.
Want to know more about sales tax and how to get started with TaxJar? Visit TaxJar.com/how-it-works to learn how you can be compliant and remove the burden of sales tax for yourself.
Ready to get started with TaxJar’s API? Head on over to https://salestax.dev and review our API documentation.