Giter Club home page Giter Club logo

chdb's Introduction

chdb implements a read-only memory mapped hash-table for PHP.

In PHP the only way to define large amounts of constants - for instance to store
the association between language and text keys and the corresponding translation
- is to use lots of defines, class consts, or create some humongous array
structure.

Even with an op-code cacher like APC or e-accelerator, defining constants this
way is both CPU and memory consuming, as each instance of php will need to
load/parse/execute the opcodes to define the constants for each request.

chdb is a solution for this problem because:
 - It takes virtually no time to load initially.
 - Only the pages of the file which are actually used are read from the disk.
 - Once a page is loaded it is shared across all the processes in the same
   machine and cached across multiple requests.

All these functionalities are provided by the operative system itself as
features of memory mapped files. chdb thus provides to PHP something similar to
what the data section provides to lower level programming languages like C.

If you are using PHP in a typical setup for a big website which remains stable
between releases you might benefit from the chdb extension. In that case you
would create a disk file containing a hashmap of key-value pairs at deploy-time,
and then map it into the memory of each php process at run-time.

An example of use of chdb for this would be to run the following at deploy-time:
  $data = array(
        'key1' => 'value1',
        'key2' => 'value2',
        // ...
  );
  chdb_create('data.chdb', $data);

Then at run-time, the keys stored in the file can be read by:
  $chdb = new chdb('data.chdb');
  $value1 = $chdb->get('key1');
  $value2 = $chdb->get('key2');

chdb's People

Contributors

lcastelli avatar jille avatar sebcode avatar

Watchers

James Cloos avatar

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.