Bringing Internet to Other 3 Billion
Hassan Aarzoo (~hassan) |
By the end of this talk we would be able to have an idea about how Python paired with some other libraries can ease us into developing a distributed system.
White Space is a semi regulated band that can be used for developing rural broadband solutions. Saankhya's Cognitive Radios solutions are aimed at addressing this. In this talk we'll discuss how we used Python for developing a Management System for a Cognitive Radios solution in Python. In particular, we'll discuss peculiar challenges that we faced while running the same system for 100s to 1000s of such devices.
- Overview of Cognitive Radios for broadband applications - 5 mins
- Architecture - Conjunction of Device Library with Django Apps, Celery and Redis - 5 mins
- Configuration and management of devices at scale - Serialize/Deserialize device instances in Redis and Celery for asynchronous task management - 5 mins
- Device Configuration / Management API - Python Django Rest Framework - 5 mins
- Q and A - 5 mins
Some of the key takeaways from this talk should be -
- Dealing with problems typical in distributed systems - (typically concurrent access to shared resources)
- Abstracting unreliable network operations to actions - (Handling issues when device is unreachable, handling multiple requests from multiple devices)
Element Management System
Usage of White Band Frequency to Provide Internet Connectivity in Rural Areas. Library Code for interaction with the device in Python. Website back-end code is done using Django and the Front-end is in React.
Device Library -
The idea behind this was simple :- a. Telnet to the device. b. Read data from the device. c. Display the data and communicate with the device through GUI (Desktop App).
Django Backend :- The real challenges started when we wanted to monitor more than one device. We decided to have a simple web based back-end for this and hence Django came into play.
We could easily send configuration details to the device through REST-API's given that the device library was already in Python. Instead of querying the device every time we decided to use an in-memory Data Structure Store i.e Redis to store information about the device. Scheduling tasks for quering data periodically from the device was simplified using Celery-an open source asynchronous task queue. The real deal was when we wanted information about other devices along with applying configuration to a selected device. a. Here is when the asynchronous functionality came into action 1. We are querying a Nominet Server to get the available white space frequency that we can use for our device. 2. Once the Server returns a frequency we select the same and configure on the device. 3. The Device Starts Transmitting at the selected frequency. b. There might be other functional devices that would be in stationary or active state, we would be collecting data from these devices asynchronously and storing it in our database through celery workers. c. There are other celery workers that periodically queries redis and the data is displayed in the front-end. d. Managing such a distributed system also presents some of its challenges where we did not want a user to query a system that is already busy with another operation. Redis provides this feature too.
This ease of integrating these libraries in Python and getting quick output escalates the development procedure to a huge extent. Python can be considered a boon in implementing a distributed system
Credits :- Saankhya Labs Private Limited
Python and Django Framework
Hassan is a beginner in software development. He has a degree in Electrical Engineering and is gradually transitioning into Computer Science. He is a learning enthusiast and firm believer of "What counts is not what you cover, but what you uncover - Walter Lewin"