We use cookies to enhance your experience. Dismiss this message or find out more.

Redis for SSO legacy systems June 28, 2017

Author: Akeem Spencer

Facebook https://spencertechconsulting.com/posts/redis-pg-together/ Twitter Linkedin Reddit

Read Time:

4 minutes

Greetings to all of you reading this in the summer of '17! <br> <br> I haven't posted anything in the month of June, but I've been very proactive within my company, binding some contracts to keep the lights on. This month I've immersed myself in the healthcare arena by understanding a little more what Artificial Intelligence is doing for its respective field. Along the development phase for this project, a project I cannot publicly acknowledge and disclose, I've had the opportunity to utilize the Redis-Memcache database within my Raspberry PI. <br> <br> Setting up a system development life cycle for this project is not an easy task, considering I had to recreate and mirror the local hospital architecture here in NY. Resources limited, the project will screen users with a login authentication module before the administrators can log in to see their own dashboard. The model replication of the hospital architecture piggybacks on the SMART FHIR protocol for the patient & admin. object fabrication. Problem is, the syntax and object notation descriptions are highly verbose and fluffed up, so I'm going to store the model object data in JSON notation. I didn't want to make the sandbox database on the project muddled and hard to interpret, so I decided to use an open source PostgreSQL database server because of my comfort. The PG instance would also live on the Raspberry PI disk space and my virtual cloud on Digital Ocean would serve as the server instance for the software application I'm scaling. <br> <br> For the window display, I went the Tcl/Tkinter route to create the object for the login screen and as I was writing the code it dawned on me how fast the application should run from sending pertinent, patient information to retrieval of patient information in an encrypted manner. I wanted to see just how much time I'd skim off the login phase if I used a Memcache DB wrapper for Postgres. I remember spending odd nights in NYC going to these meetup sessions where people were utilizing Rabbit, MongoDB and Redis. Redis is a rather new platform and interface and I already have a server running on this app I'm serving the web pages to you on right now! So I went ahead and downloaded the tar file and made the configurations in my virtual session. <br> <br> At the concept development phase, the overhead and customization for the Redis server were pretty intuitive and I stored the binary executable for the Sentinel, server, and client within the local virtual environment of my Debian os. The ecosystem of the Redis shell is very green and doesn't manifest into a heap of crap on my hard drive. <br> <br> The Redis configuration is simplistic to operate with just a quick boot within the local bin folder by pressing: `./redis-server`. Disregarding the warning signs, my server instance is prepped and ready to go! <br> <br> <br> ![REDIS-START-IMAGE][1] <br> <br> <br> So as I was setting up the login screen, I wanted to test the speed and the lines of code it took to enter the user's dashboard. With the Postgres test the following results were discovered using a clock from start to finish: <br> <br> <br> ![pg][2] <br> <br> <br> Versus, the Redis performance time it takes to index the table and retrieve the information from the user: <br> <br> <br> <br> ![redis][3] <br> <br> <br> And here's the code. Slightly different block segments for db authentication, but does the same thing: <br> <br> <br> ![CODE-FOR-DUMMIES-JUST-KIDDING-UZ-SMART][4] <br> <br> <br> Now, of course, these values weren't applied to an ANOVA test case to ensure the confidence interval of these values is stellar, but from the samples collected it seems like 50% decrease in authenticating a user seems worthwhile. Especially in a hospital environment where user communication is paramount. <br> <br> The invocation for the next phase is to emulate the destop window of 'Patient Perfect' EMR system and gain a grant to finish the project with the skills I've accumulated being self-taught. <br> <br> This week marks a year into my freelance venture and it's been upscale since last year. If you have a software or hardware idea you want to bring into fruition, hit us up! We're looking for interns to work with as well. No idea is foolproof, but no idea shouldn't fall on deaf ears. Voice your opinions and translate them into products. We're ready for you! <br> <br> [1]: https://spencertechconsulting.com/media/redis-server-startup.JPG [2]: https://spencertechconsulting.com/media/pg_login_time_encapsulation.png [3]: https://spencertechconsulting.com/media/redis_login_time_encapsulation.png [4]: https://spencertechconsulting.com/media/redis_vs_pg.JPG

About The Author



Akeem Spencer is the owner, manager, and architect behind Spencer Tech Consulting. You can catch him at @UUID_Akeem or find him on LinkedIn @ Akeem Spencer. My hobbies include running, active boxing training intervals such as Shaun T Insanity Workouts, and giving it the best I've got in 2018 onwards, with projects both virtual and physical.