Case study: 2ndQuadrant and tastyworks – boosting PostgreSQL database performance by 400%
Tastyworks is a retail brokerage firm based in Chicago, US, that is leading a financial revolution for the do-it-yourself investor. It is a sibling company of tastytrade.com, which is one of the fastest growing online financial networks in the world. tastyworks is a wholly-owned subsidiary of tastytrade, Inc.
tastyworks provides a powerful and easy-to-use trading platform that interacts with the firm’s distributed microservices infrastructure. PostgreSQL was its database of choice, as the in-house team had previously implemented it in other parts of the company’s infrastructure.
The database powering the tastyworks infrastructure was configured with basic replication and a baseline configuration suited for a mix of transactional and analytical workload. tastyworks subsequently launched in the brokerage sector, and began facilitating customer trades in January of 2017.
Shortly after launching, the rapid success of the tastyworks platform created a larger than expected production volume, leading to unforeseen performance issues.
As the volume of the high throughput transactional workload grew, the technical team’s existing knowledge from running PostgreSQL on other projects did not provide insight into the specific performance and scalability issues that were manifesting. The team quickly realised that it would be necessary to diagnose bottlenecks and scale out the hardware appropriately to achieve immediate performance improvements and prepare the platform for future growth.
Faced with additional engineering and scaling challenges, the team felt a strong need to bring in specialists for architectural consultancy. tastyworks began to explore the options on how to best scale their database infrastructure and tackle performance issues simultaneously.
tastyworks conducted thorough research and reached out to several PostgreSQL service providers to discuss consultancy services, database assessment, and support. 2ndQuadrant stood out above all others for having a more in-depth technical knowledge and superior services. tastyworks was especially impressed to see that the core PostgreSQL committers at 2ndQuadrant were directly involved in the consultancy and support services.
2ndQuadrant experts performed an architectural health check of tastyworks’ PostgreSQL database. A thorough analysis was conducted, which revealed a variety of sporadic performance issues that were responsible for slowing down the database. Consultancy services early on helped tastyworks pin down issues that were caused due to overzealous auto-analyse and auto-vacuum operations.
After the analysis was completed, 2ndQuadrant recommended changes needed to ensure a high-performing database. Due to the critical nature of their data, tastyworks chose to have an in-house team implement the recommended changes. Coupled with 24/7 Production Support and the guidance of 2ndQuadrant Consultants, tastyworks was successful in optimising their database by:
- Implementing repmgr for replication between servers to easily manage high availability, and enhancing overall productivity by reducing administrative overhead.
- Introducing pgbouncer for connection pooling. Repmgr and pgbouncer worked together in the scaling of the overall infrastructure and to reduce connection overhead.
- Updating their PostgreSQL configuration and tuning Linux to meet best practices.
- Designing, configuring, and seamlessly migrating to new, purpose-built server hardware for optimal performance and a substantial increase in headroom for forward growth.
After implementing these changes, tastyworks was able to scale their microservices infrastructure horizontally. This allowed them to manage thousands of simultaneous client connections while maintaining high levels of performance for the underlying PostgreSQL systems. This more robust architecture resulted in the ability to maintain high performing end-user trading platforms, even during periods of peak volume.
Jordan von Kluck, CTO at tastyworks, confirms: “Deploying PGBouncer allowed us to stay ahead of performance issues that we knew we’d run in to due to increasing transactional volume. It was implemented in parallel with other re-engineering and performance optimization work and the impact was immediately noticeable. During our daily load test, we observed an immediate two to four times improvement in peak throughput.”
Seeing the drastic improvements in performance, tastyworks realised the importance of having PostgreSQL experts available around the clock, and they initiated a partnership with 2ndQuadrant under their 24/7 Platinum Support Plan.
“Working with 2ndQuadrant has been an excellent experience. Its support team has a wealth of knowledge and always provides an in-depth answer to our questions in a very timely fashion. Between support, consulting on specific issues and guidance on overall best practices, 2ndQuadrant has been an invaluable resource to us at tastyworks,” von Kluck says.
- 24/7 PostgreSQL production support
- Architectural health check
2ndQuadrant provides PostgreSQL solutions for the enterprise. Our support engineers have over 100 years of combined code contributions to the PostgreSQL project, making us the only company to contribute enterprise features to all of the last 14 releases.
This is paired with 17+ years of hands-on experience through client engagements and allows us to integrate customised solutions with our customers – making 2ndQuadrant the Gold Standard for PostgreSQL products and services.