Posts

Showing posts with the label Redis

Autocomplete Using Redis and Python

Autocomplete using Redis and Python Reading about the use cases of the Redis I came across a use case in which we can implement an autocomplete functionality using it. I am going to show you the code to implement the Autocomplete in under 40 lines of code. Here we go: #redis client for python import redis #flask to expose api's to outside world from flask import Flask,request,jsonify app = Flask("autocomplete") #creating a redis connection r = redis.StrictRedis(host='localhost', port=7001, db=0) #route to add a value to autocomplete list ''' FORMAT: localhost:5000/add?name=<name> ''' @app.route('/add') def add_to_dict(): try: name = request.args.get('name') n = name.strip() for l in range(1,len(n)): prefix = n[0:l] r.zadd('compl',{prefix:0}) r.zadd('compl',{n+"*":0}) return "Added" ...

Celery Optimization For Workloads

Image
Introduction Firstly, a brief background about myself. I am working as a Software Engineer in one of the Alternate Asset Management Organization ( Handling 1.4 Trillion with our product suite ) responsible for maintaining and developing a product ALT Data Analyzer. My work is focused on making the engine run and feed the machines with their food. This article explains the problems we faced with scaling up our architecture and solution we followed.  I am dividing the blog in the following different sections: Product Brief Current Architecture Problem With Data loads and Sleepless Nights Solutions Tried The Final Destination Product Brief The idea of building this product was to give users an aggregated view of the WEB around a company. By WEB I mean the data that is flowing freely over all the decentralized nodes of the internet. We try to capture all the financial, technical and fundamental data for the companies, pass that data through our massag...