Advertisement

Stance Tackles High Performance, Scalability Challenge for E-Commerce with NoSQL

By on

stance_nosql_012546Stance Socks is all about sock innovation. Take its Deathless Thread offering, which is designed to defeat skateboarder shred. It’s constructed of Dyneema, a fiber that’s 20 times more durable than a regular athletic sock. The material will hold firm even when the shoe it’s encased in blows out. Couple their sock ingenuity with a new NoSQL solution and you get amazing results.

“We’re excited about what technology we bring to our socks, but we’re not just about sock innovation,” Andrew Spencer, Director of Technology, told attendees at DATAVERSITY’s™ NoSQL Now! 2015 Conference. In a market where the startup is competing with big brands like Nike, it also has to be innovative about how it approaches e-commerce. It is hard at work doing so, turning its Stance.com website into a single-page application with the help of Mean.IO’s fullstack Javascript framework encompassing Mongodb, Express.js, Angular.js, and Node.js for rapidly setting up and deploying web apps, websites, web services, and APIs. And it relies on Redis, an open-source in-memory data structure store used as a NoSQL database, cache, and message broker, to handle huge traffic bursts.

Redis Labs, which offers enterprise-class Redis as a managed service, has been its partner in a challenge Stance set for itself.

“Imagine your CEO comes in and says, ‘You are going to be DDOS’d,’” Spencer said. “This isn’t traffic you can block. This is traffic that we want. You have to handle every request that comes in in a responsive manner, so end-to-end latencies need to be very, very low.”

Stance had engaged with singer Rihanna to be a creative director, and in conjunction with her making the announcement to her more than 74 million social media followers, was the news of a limited edition Rihanna socks offering. Let the traffic floodgates open and pick up the pace on ensuring that checkouts would happen fast and that users would know what was going on as it was going on.

Getting Rihanna Ready

With the huge rush of traffic about to begin and her fans ready to beat each other to the finish line to get a pair of the limited edition socks before they were gone, Spencer found himself in the position of essentially building a Ticketmaster for Stance. Stance already was hosting its own Redis cluster on Amazon Web Services to cache product data for more than 3,000 SKUs. Its low latency allows near real-time distribution of large data sets to the client. “As an example we can serve a collection of 100,000 models, sorted, filtered, paginated – any transformation you can think of – in less than 5 ms. [through WebSockets],” he said, so that to the user of the site it seems like he gets instant responsiveness to large sets of data.

The decision to use the high-performance RedisCloud service from Redis Labs was informed by Stance’s familiarity with Redis, as well as its knowledge of Redis’ simplicity and strong community tools support. This was so important given that Spencer’s team had only about a month from the time Stance signed the contract with Rihanna to get ready “for traffic [that was] orders of magnitude more traffic than we would ever envision receiving,” and that its own infrastructure was not prepared to handle.

The need to be able to flawlessly auto-scale its WebSockets, to keep from having everything fall apart when the e-commerce site received all the traffic Stance expected, came into play in the company’s choice of RedisCloud services. All Stance’s infrastructure lives in the Cloud, and the only Cloud provider that offered auto-scaling for WebSockets in an easy manner was Google Compute Engine (GCE), according to Spencer, and “RedisLabs is the only Redis provider on GCE.”

If Stance was going to auto-scale its WebSockets, the underlying data architecture had to auto-scale with it too, he said. Without auto-scaling on the Redis side of the infrastructure, it wouldn’t have mattered that the company had a great GCE auto-scaling infrastructure. To properly auto-scale requires a shared nothing architecture, he said: All Stance services are very loosely coupled and can all scale as they need to. “That’s important. If you have one bottleneck, the entire system collapses, and it doesn’t matter where that bottleneck is,” Spencer noted.

Auto-scaling doesn’t have to be hard, he said, and organizations can scale their businesses in a cost-effective manner using Redis and GCE.

The need to be able to properly and responsively manage the traffic that would be heading its way required asynchronicity and low latency, too, which RedisCloud offers by providing coherence among its WebSockets. “Our sockets talked with Redis and because Redis responds so quickly we were able to maintain extremely high throughput with our concurrency,” Spencer said. Following Rihanna’s social postings of the news, while Stance was serving more than tens of thousands of requests per second, [the RedisCloud] maintained a latency of under .1 ms., he reported.

A Successful Switch

Stance made the switch to RedisCloud on July 12 – just three days, and a lot of load testing, before Rihanna made her big announcement. While that sounds risky, Spencer admitted, he and his team had great confidence that paid off. “I don’t believe that if we hadn’t done that that we would have survived the traffic,” he said.

And survive it Stance did. RedisCloud wasn’t stressed by this use case at all, he said. When the limited edition socks went on sale, each user was updated via WebSockets in real time of inventory levels. It was a fast-moving marketplace, as transactions were made or as inventory moved out of the carts of users who didn’t complete them in the allotted timeframe and back into the marketplace. All the limited edition socks sold out.

Spencer called the new NoSQL solution deployment a huge success – and one whose work isn’t over yet by a long shot. More limited edition products clearly are in Stance’s future. “Using RedisCloud it didn’t take more than couple of weeks to build a system that now allows us to offer at high volumes any type of limited edition product,” he said.


Register for the NoSQL Now! 2016 Conference Today


button-nosql-open

Here is the video of the NoSQL Now! 2015 Presentation:

 

 

 

 

 

 

 

 

 

 

 

 

Leave a Reply