Can we help you?
We upgraded JailCore’s cloud-based inmate management platform by modernizing its infrastructure, optimizing computational processes, and enhancing the user dashboard, all while leveraging the power of Ruby on Rails .
Who is JailCore?
JailCore is a cloud-based inmate management platform designed to simplify and secure a variety of correctional facility tasks—from cell checks and observations to head counts and inmate interactions. Born from an aspiration to create a simple yet comprehensive inmate management system, JailCore aimed for transparency, safety, and reliability. With CEO DJ Kreal and CTO Robby Clements at the helm, JailCore had made significant inroads into correctional facilities across the United States.
Despite its success, the JailCore platform grappled with substantial technical challenges. The infrastructure was outdated, and critical functions took a lot of time and computing power to complete. In particular, one core function consumed a disproportionate 37% of CPU resources every time it ran - which was several times daily. Compounding these issues, the user dashboard had complications stemming from incomplete development and features that didn't operate as expected. These challenges not only led to administrative inefficiencies but also escalated safety risks in a time-sensitive, high-risk correctional environment.
JailCore's existing infrastructure incorporated Kubernetes clusters and a Postgres database. However, the setup relied on outdated versions of these components that lacked the optimizations available in more recent releases.
Database and Rails n+1
DBA pinpointed an "n+1 problem" as a major performance hindrance in the JailCore application. This is a common challenge in Ruby on Rails apps. It arises when an app conducts excessive database queries, inflating the load on the database and computational resources. Additionally, the JailCore app used an older version of Postgres, which lacked the performance-boosting features of newer versions.
One of JailCore’s ambitious offerings was a customizable dashboard, which although innovative in conception, came with its own set of challenges. Previous development left the dashboard with an unfinished feature that, in theory, allowed users to modify the layout by ordering, positioning, and resizing elements. However, resizing didn’t work, the widgets only displayed dummy data, and users could not save their personalized dashboard states.
The DBA team worked closely with JailCore's CTO, Robby Clements, to ensure a seamless exchange of insights and product context. This collaborative approach not only accelerated development but also ensured that solutions were precisely tailored to JailCore's specific needs. The real-time collaboration between the teams facilitated quick decision-making and the rapid implementation of critical improvements.
DBA's expertise was a game-changer for JailCore. In just 6 weeks, they dismantled all our bottlenecks, allowing me to shift my focus from constant maintenance to driving new features and innovation
CTO of JailCore
Optimized Data Operations
The DBA team leveraged their Rails expertise to develop a comprehensive solution to the n+1 problem. By shifting some of the processing functionality from the application layer to the database layer and utilizing database views, they significantly reduced the time required for query execution. Additionally, batch insert processes were introduced, replacing time-consuming one-by-one data imports. Caching mechanisms were also implemented, minimizing the load on the database. Moreover, the upgrade to a newer Postgres version introduced significant optimizations to index management and JSON queries.
These many improvements mitigated the Rails n+1 problem, reducing excessive database queries and enhancing the platform's overall responsiveness.
The DBA team upgraded JailCore’s Kubernetes and Postgres versions. This essential overhaul was completed within a tight timeframe, and ensured that JailCore's platform was running on modern, optimized infrastructure. In particular, the migration of Postgres to a newer version not only addressed existing inefficiencies but also primed the system for future scalability.
DBA was able to identify and resolve bugs that prevented some important functions from executing. These fixes, along with earlier data optimizations, cleared the way to complete old dashboard features, as well as develop new ones. Through real-time data access (web sockets) via dashboard widgets, users gained instant visibility of facility operations. They could also save customized widget states, allowing them to tailor the dashboard to their individual roles.
Seamless Integration of Diverse Technologies
With the integrations working properly, the team implemented two approaches to presenting data on the front-end, both leveraging the power of the Rails back-end framework.
- ERB (Embedded Ruby): This method embeds Ruby within HTML. It's used for more static parts of the application, where content remains largely consistent. With this approach, the back-end sends HTML embedded with Ruby code in response to user interactions.
- React with JSON: For sections of the application requiring greater flexibility and user interaction, the back-end sends raw data in a JSON format using websockets and HTTP calls. This approach enables the React-powered front-end to determine the optimal presentation of the data to the user.
By integrating these techniques, DBA ensured that users enjoy a dynamic and seamless experience, regardless of the underlying technology.
The close collaboration between DBA and JailCore led to exponential improvements in performance and user experience. DBA’s multi-dimensional solutions improved database interactions by orders of magnitude. Functions that previously took nearly an hour now take mere seconds to complete. The dashboard is now a robust tool for users, allowing for real-time insights into facility operations and customizable experiences tailored to individual roles. Thanks to DBA’s extensive technical skillset, JailCore now offers a dynamic, responsive platform, optimized for the demands of correctional facility environments.