Unlocking Speed and Complexity: PW Help Centre
By Ritvik Bhatia, Internal Tooling and Automation (Backend)
Introduction
Embarking on the journey of transforming a legacy static Contact Us page into a dynamic, high-performance self-serve tool has been nothing short of an adventure. As a backend developer at Physics Wallah, I’m excited to share the intricate details and pivotal decisions that went into crafting what we proudly call the “PW Help Centre.”
The Challenge: A Legacy to Transcend
Our expedition commenced with the realization that our existing Contact Us page, static and hardcoded, was not only outdated but posed a considerable challenge in adaptability. Any modification in categories or subcategories seemed like navigating a labyrinth, prompting us to rethink and revamp our approach. Some of the challenges that we faced were
- Students would create multiple tickets for the same query.
- We did not have basic FAQs on our platform. Many of the FD tickets can be solved by the basic FAQs.
- Many of the tickets raised by students did not have complete information. SST Agents need to connect with the student to and fro to collect the relevant information so that they can completely resolve the issue.
Architectural Decisions: Flexibility and Speed
Dynamic Mapping for Admins: Our first key decision was to introduce dynamic mapping for categories and subcategories. This not only granted our admin users the flexibility they craved but also laid the groundwork for all future modifications. We can now show different chat flows to different user segments making it fully customisable according to our needs. Operations teams can make any change real time themselves without involving the developers.
Chatbot Vibe:
Secondly, we wanted to create a feature where students can resolve all their queries in a more intuitive and interactive way. For it to work, we divided the flows into 2 components :
LEVELs and ACTIONs where LEVELs are the clickable options that lead to other flows and ACTIONs are generally the leaf nodes, the actionable items or responses. ACTIONs can be of many types like HTML Text FAQ, FAQ with images, videos, CTAs etc. It can even be a complete predefined workflow. Thus adding a completely new functionality won’t even be a challenge for this product.
Plug-and-Play SAAS Product: What sets the PW Help Centre apart is its adaptability. It’s not just a solution for Physics Wallah; it’s conceived as a plug-and-play SAAS product. Organizations can seamlessly integrate it with minimal effort, making it a versatile solution for various contexts. PW has an umbrella of companies and they operate as different organizations.
Semantic Search Integration: A standout feature was the integration of semantic search powered by AI. This enhancement understands student queries, delivering relevant results and elevating the overall user experience.
Behind the Scenes: Read-Heavy Dynamics
The strategies and tradeoffs are explained below -
Frequency of Chat Flow Changes
Understanding the operational landscape is crucial. While the chat flows within the PW Help Centre experience changes infrequently, occurring approximately once a week, the sheer volume of reads generated by students is staggering, reaching into the millions. This unique characteristic presented us with the challenge of optimizing the backend to ensure a responsive and swift user experience.
Strategic Approaches: Caching Strategies
One cornerstone of our approach involves the strategic implementation of caching mechanisms. By storing frequently accessed data in a cache, we significantly reduce the need to fetch information from the database for each user interaction. This not only minimizes latency but also conserves valuable backend resources, contributing to the overall efficiency of our system.
MongoDB Embedding Over Referencing
MongoDB, our chosen database, offers two primary approaches for managing relationships between data: embedding and referencing. Given the read-heavy nature of the PW Help Centre, we strategically opted for embedding. This entails nesting related data directly within the document, eliminating the need for additional queries to fetch associated information. The result is a more streamlined and faster retrieval process, particularly beneficial in scenarios where rapid access to data is paramount.
Here in our use case, we have tried to store all data related to a particular flow in a single preprocessed document. So that it can be easily fetched from cache by a single call and won’t affect DB much even if the cache misses. All Data related to a flow is fetched by a single API call so the UI doesn’t have to call different APIs on every user click.
But as everything in system design is a trade-off it also has it’s negatives, it may have optimized the student side very much but the CRUD operation on the admin side becomes very difficult,
To make any operation we will have to traverse in an N-ary Search Tree manner.But It’s manageable because the number of writes are negligible in comparison to the reads.
Judicious Use of Indexes
Indexes play a pivotal role in optimizing database queries. In the context of our read-heavy environment, we employed a judicious approach to index usage. By carefully selecting and creating indexes on fields that are frequently queried, we ensure that data retrieval remains swift and responsive.
Performance Metrics: Beyond Expectations
Performance is important for seamless experience to PW students, PW operates on scale and has DAO of 2.1 million students per day.
Rigorous Speed Testing: Our commitment to performance involved rigorous speed tests and benchmarks to ensure the features not only met but exceeded our expectations. To know more about PW load tests, refer here.
Significant Impact: Reducing Agent Queries and Average Resolution Time
The implementation of the PW Help Centre has not only transformed our user experience but has also had a profound impact on our support team. Significantly reducing the number of queries raised to our agents, the tool has streamlined our support processes, enabling our agents to focus on more complex and critical student issues.
Average total ticket volume has dropped by 75% after the help centre was made live.
Average resolution time was also improved, earlier as explained above many of the tickets raised by students did not have complete information. SST Agents need to connect with the student to and fro to collect the relevant information so that they can completely resolve the issue. Now that they have enough information and the to-and-fro was not required that much, the remaining 25% tickets we are getting the average resolution time was also dropped by 85%.
Lessons Learned and Forward Momentum
As a backend developer, witnessing a feature seamlessly manage complexity and data while upholding speed is an indescribable joy. The revamped Contact Us page, now the PW Help Centre, stands as a testament to the dedication and ingenuity of every developer involved in this transformative project.The journey doesn’t culminate here. It’s a continuous learning process, and our commitment is unwavering towards constant improvement. Every triumph introduces new challenges, and we stand ready to confront whatever the future holds for our dynamic PW Help Centre.