Giter VIP home page Giter VIP logo

manic-mapped-memory-server's Introduction

Manic - Hella Fast Memory Mapped Lookup Server

Manic is a asynchronous REST server that allows super fast querying of large memory mapped files, giving O(1) lookup times on the order of 5-10 microseconds (local server response around 1ms), using standard desktop hardware.

Manic runs on top of Sanic, a super fast, Flask-like async platform for Python

Even more, Manic allows you to write protect the file in memory at the page level, and check a previously calculated SHA256 of the text file, against your own SHA256, before it is loaded into a memory map, providing hella fast lookups in the single digit microsecond range on your laptop.

Manic was extracted from an Ethereum oracle project I am working on, and made open source under an MIT license. The functionality has been enhanced beyond the original requirements for the oracle. This repo is still a work in progress, but Manic is fully working and functional for your fast lookup use cases, and can load files in sizes up to the memory capacity you have on hand.

At the moment, Manic will only ingest and index delimited text files.

run it!

  • clone the repo [email protected]:robinagist/Manic-Mapped-Memory-Server.git
  • high recommended that you run Manic in virtualenv with at least Python 3.5
  • install Sanic pip install sanic
  • install pysha3 pip install pysha3
  • install xxhash pip install xxhash
  • Manic is already configured to index two example files in the /manic/memfiles directory
  • configure the BASE_PATH in config.py to point to your local manic root
  • from the manic directory, start the server: 'python server.py` which will immediately index the files
  • the server listens on port 5216 by default
  • the query string on the URL for the server will be of the format:
idx=<index_name>&st=<search term>

Index_name is the column you wish to perform a lookup. Column names are index names.

Manic comes with two example files: a short list of poker hands and scores, and a subset of the FCC database for ham radio licenses. It is configured to run right out of the box with those.

try curl "http://0.0.0.0:5216/f?idx=call&st=KC1IVY" from a terminal, to do a callsign lookup. you should get one result

or try curl "http://0.0.0.0:5216/f?idx=cat&st=D" and you should get around 250 results

Each column name is also the index name. To do a lookup on a column -- say for an FCC callsign -- use the call column and the search term st is an FCC assigned callsign, hopefully appearing in the file. The columns are defined in the configuration file config.json for the file that is being indexed. These are located in the ~/memfiles subdirectory.

More documentation later.

manic-mapped-memory-server's People

Contributors

robinagist avatar

Stargazers

 avatar

Watchers

 avatar  avatar

manic-mapped-memory-server's Issues

documentation

0 - installation
1 - quickstart
2 - configuration

need an exception when a column name is duplicated

currently, if the mapping configuration for the files have one more columns with the same name, the last column with that name will have the correct index. searches intended for the other columns will return 'no result'.

refactor and directory structure

indexed files and/or indexed file packages?
upload directory?
configuration directory?
keys directory?
helpers separated into their own files (response helpers)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.