BaseLang - Online Education Booking

About BaseLang
BaseLang is an online Spanish school that offers students unlimited 1-on-1 classes with native teachers via video chat. BaseLang’s proprietary platform is a one-stop solution for hosting all of the core student, teacher and admin functions.
Thousands of students use the platform each day to book classes, explore teacher bios, access the curriculum, and track their progress. It’s also used on a daily basis by hundreds of teachers, in addition to other key stakeholders in the company.
The Challenge
Application performance is key to customer retention and milliseconds matter when it comes to delighting customers with their digital experience. BaseLang uses a MariaDB database that maintains, among other things, the booking availability for their tutors, student profiles, student schedules, progress reports, and billing information. As BaseLang’s customer base and platform usage grew, they saw their database impacting the responsiveness of their application.
BaseLang hosts its application with DigitalOcean, which, like many other cloud providers, offers the flexibility to scale the database vertically, adding more CPU and memory resources to accommodate increased demands. After several iterations of scaling, however, costs were increasing significantly.
BaseLang was looking to scale further, increase performance, and lower costs.
Daily Busy Period
BaseLang has a time of day when booking activity is high. New appointments become available at a specific time, causing a surge in availability checks and bookings by users. During this period, database activity averages approximately 830 requests per second with observed spikes above 1300 requests per second.
This spike in activity often overwhelms the database instance due to resource contention resulting in slower application load times.
With PolyScale in place, we could reduce the database load by reducing the direct queries to the database. Moreover, the query analysis from their team could help us in identifying the areas for optimization. Overall, it helped us in reducing the database size & cost by 75%.
Niall Quinn
Managing Director, BaseLangBaseLang has customers spanning multiple countries. However, there are periods when their application can see very little usage and therefore, before using PolyScale, the allocated database compute was heavily underutilized. In real terms, this meant the instance size and associated resources were always set at the size to cover the high traffic periods, and during the periods of inactivity, the costs were the same. This is the classic situation where dynamic scaling or serverless resources are required. Being able to effortlessly scale up and down in real-time is the key to cost efficiency.
Database Observability
The overall number of requests BaseLang sees to their database is high. In addition to solving the resource performance issues in general, BaseLang also values understanding if any code efficiencies could be made within the web application i.e. understanding slow, un-optimized queries and other inefficiencies.
PolyScale Solution
PolyScale is an intelligent database cache. It automatically inspects database traffic using AI, optimizing performance by caching specific query results. When a database query passes through PolyScale, it checks to see if the data is in the cache and if found, returns the data. This means that the SQL query result is returned directly from PolyScale rather than the database, offsetting that workload. In addition, PolyScale is serving the query results from the cache so there is no query contention within the database. As a result, query performance does not degrade with the load.
Cache Consistency
A core part of BaseLang’s online booking use case is that the data has to be consistent — only available slots should be shown as available within their application. In this case, the cache must be invalidated upon each booking so that the next read of available events is valid. This is a typical caching use case where developers are forced to write code to manually invalidate the cache upon a booking. PolyScale provides this automatically. It monitors incoming SQL queries for data changes and automatically invalidates the appropriate cache entries so that the next relevant read reaches the origin database. This is also true for a multi-region environment. It is worth noting that this pattern is eventually consistent, much like a database read replica.
Implementation
PolyScale provides a high-performance, effective and simple to implement solution for BaseLang. Once BaseLang decided to implement PolyScale, they were able to do so in literally 15 minutes. After signing up for a PolyScale account, BaseLang created a cache within the PolyScale application by just entering the database hostname. BaseLang next allow-listed the PolyScale Points of Presence locations, creating a secure network connection to the database.
Then, all BaseLang had to do was replace their database’s hostname in their application with PolyScale and append the PolyScale cache ID to the database username in the app. That was it! Database requests from BaseLang now are passing through PolyScale, routed to the point of presence closest to BaseLang’s application.
Because BaseLang is running its infrastructure on DigitalOcean, PolyScale deployed a point of presence to the same DigitalOcean region to reduce the latency between the application and the cache. As customer demand warrants, PolyScale can deploy additional locations typically in less than an hour.
PolyScale Results
In an average week, PolyScale processes approximately 70 million database queries, and around 80% of those are cacheable i.e. reads. This equates to almost 15 hours of total database execution time that is served from PolyScale rather than the origin database.
With PolyScale in place, Baselang was able to downsize its compute resources by 75%, a significant cost saving. In addition, PolyScale let BaseLang see and understand every individual SQL query. Database observability through PolyScale has allowed BaseLang to identify inefficient SQL queries which have led to further optimizations both with application tier logic as well as specific SQL queries.
PolyScale allowed BaseLang to handle their busy times without seeing slowdowns in application performance. Being serverless, PolyScale is utilized based on real-time usage and hence during periods of low activity, resource costs are reduced. Maintaining a smaller origin database and a serverless cache keeps costs optimized.
Finally, although BaseLang’s key focus was optimizing performance and costs for their origin database, they are now in a position to move to a multi-region architecture with ease. PolyScale will serve database queries from the closest location to any application server, so if they choose to deploy more app locations, no changes are needed to scale their data tier.
Next steps
Contact PolyScale to learn more about how you can easily improve your application performance, support global users, and save money on your database infrastructure.
“ We set out to improve the performance of our database during our peak booking period. Before PolyScale we had to size our database for the largest spikes in usage. Being serverless means we only pay for the capacity we are using. ”