Giter Site home page Giter Site logo

ffindex-java's Introduction

Maven Central Changelog

Overview

FFindex is a very simple index/database for huge amounts of small files. The files are stored concatenated in one big data file, seperated by \0. A second file contains a plain text index, giving name, offset and length of the small files.

Performance

Performance was measured on a collection of 190k BinaryCIF files (stored as .bcif.gz). Multi-threaded operations could use up to 12 cores.

Read Times (JMH)

Approach read 1,000 random files [ms]
File System 48
FFindex-java 30

Write Times (JHM)

Approach bundle 190,000 files [s]
tar 57
tar + gzip 166
tar + pigz (multi-threaded) 62
FFindex-java (single-threaded) 80
FFindex-java (multi-threaded) 12

File Sizes (du -sh)

Approach size [GB]
plain directory 3.8
tar 3.6
tar + gzip 3.5
FFindex-java 3.4 GB (data), 6.0 MB (index)

Usage

FFindex-java provides access to a "file bundle", i.e. a pair of a FFindex data file and an index file.

Read-Only Bundles

Open a file bundle using:

ReadableFileBundle readable = FileBundleIO.openBundle(dataPath, indexPath).inReadOnlyMode();

Bundles provide some information about the content of a bundle (like the number of files and the names of registered files). Read individual files by invoking #readFile(String filename). All data read is returned as ByteBuffer.

Write-only Bundles

WritableFileBundle writeable = FileBundleIO.openBundle(dataPath, indexPath).inWriteOnlyMode();

Writable bundles can write data using e.g. #writeFile(String filename, ByteBuffer content).

Bundles for Reading and Writing

AppendableFileBundle appendable = FileBundleIO.openBundle(dataPath, indexPath).inReadWriteMode();

Appendable bundles support all functionality of read-only and write-only bundles. However, they require more memory to track metadata of written files, so it's a good idea to use read-/write-only bundles if possible.

Details & Limitations

No guarantees are made that files produced by this project are interoperable with the original FFindex files or implementations. This implementation is motivated by FFindex and produces identical files in simple cases. However, the original FFindex anticipates index entries to be sorted (to perform binary search on it), this implementation writes entries in their insertion order and implements access by a map.

The maximum size of individual files to store is ~2 GB. The maximum number of files is capped by the size of Java arrays as well.

Copyright

FFindex was written by Andreas Hauser [email protected].

FFindex is registered trademark of the Ludwig-Maximilians-Universität, Munich (LMU). FFindex is provided under the Create Commons license "Attribution-ShareAlike 4.0".

The reference implementation can be found at: https://github.com/ahcm/ffindex

Check out the ffindex command-line tool for useful functionality that isn't part of this project.

ffindex-java's People

Contributors

jonstargaryen avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  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.