Skip to content

Better code base #32

Closed
Closed

Description

@MaxxDau

First of all, nice work.
But it would be much easier to help you with the expansion and development, then the structure would be different.
As an example it is not easy to build memcached / APCu or Redis as cache here.
Also the choice of the storage format (JSON / Serialze) can't be easily extended here, because absolutely no changes to the code are planned. Whereby this would be very easy to do.
To be able to manage tables / instances better, a class would be very good.
https://gist.github.com/Steinweber/6b8340e0dd6091f7dcffdbce235d6c2d

Activity

  1. rakibtg commented on May 21, 2020

    @rakibtg
    Member

    Hi @Steinweber, hope you are doing great!
    I have been thinking the same at this time being, looking for some available time and recommendations as well. Besides that I am planning for a version 2 of SleekDB where it can iterate over inline JSON in a single file.
    I am testing different implementations and the inline JSON implementation is also super fast, as it can traverse and check for JSON data in a document which has 1.6 millions row, each row contains 665 bytes of data just within 1-2 second! Instead of using json_encode it is using a custom made solution to read the data.
    Please feel free to drop your ideas here on how we can make it more portable and organised as well.
    :)

  2. MaxxDau commented on Jun 4, 2020

    @MaxxDau
    Author

    Im working on a new version. But i have some problems with the memory usage.
    Loading JSON to PHP array incrase the memory by factor 3.5 - 4 of json string size.
    A 1,8 mb json will result in 6,7 mb memory usage.

    With 256 mb memory i can use 250.000 - 280.000 Objects like this

    { "id": 12, "first_name": "Gabriello", "last_name": "Hirjak", "email": "[email protected]", "gender": "Male", "ip_address": "86.232.107.197", "plants": "Ericaceae", "app": "Alphazap", "__id": "1" }

    It is now the question for which purpose the database should be used. A large database based on files is a horror.

    Load 10 entries from file: 1.2ms
    Create 10 entries: 0.4ms

    Load 100 entries from file: 1.4ms
    Create 100 entries: 0.5ms

    Load 1,000 entries from file: 4.1ms
    Create 1,000 entries: 2.6ms

    Load 10,000 entries from file: 30ms
    Create 10,000 entries: 23ms

    Load 100,000 entries from file: 210ms
    Create 100,000 entries: 310ms

    I don't think anyone should use such a database with more than 100,000 entries. There are enough other solutions for that.
    I will also test the performance when loading several documents with 25,000 entries. Do not assume that this will be faster.

    For the best performance a good SSD (NVMe) is required. Or the best solution is a RAMDisk. A RAMDisk will push the performance realy good.

  3. Timu57 commented on Jan 26, 2021

    @Timu57
    Member

    We refactored and rewrote the whole SleekDB project. Now it has a better code base structure.
    Developing and expanding SleekDB now is much easier.

    Feel free to reopen this issue if needed.
    The db.php file you added looks really good. If you want to implement that feature PR's are always welcome.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions