DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports Events Over 2 million developers have joined DZone. Join Today! Thanks for visiting DZone today,
Edit Profile Manage Email Subscriptions Moderation Admin Console How to Post to DZone Article Submission Guidelines
View Profile
Sign Out
Refcards
Trend Reports
Events
Zones
Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Partner Zones AWS Cloud
by AWS Developer Relations
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Partner Zones
AWS Cloud
by AWS Developer Relations
The Latest "Software Integration: The Intersection of APIs, Microservices, and Cloud-Based Systems" Trend Report
Get the report
  1. DZone
  2. Data Engineering
  3. Data
  4. The Cost of Getting Data from LevelDB

The Cost of Getting Data from LevelDB

Oren Eini user avatar by
Oren Eini
·
Mar. 12, 13 · Interview
Like (0)
Save
Tweet
Share
4.72K Views

Join the DZone community and get the full member experience.

Join For Free

we are currently investigating the usage of leveldb as a storage engine in ravendb. some of the things that we feel very strongly about is transactions (leveldb doesn’t have it) and performance (for a different definition of the one usually bandied about).

leveldb does have atomicity, and the rest of cid can be built atop of that without too much complexity (already done, in fact). but we run into an issue when looking at the performance of reading. i am not sure if that is unique or not, but in our scenario, we typically deal with relatively large values. documents of several mb are quite common. that means that we are pretty sensitive to memory allocations. it doesn’t help that we have very little control on the large object heap, so it was with great interest that we looked at how leveldb did things.

reading the actual code make a lot of sense (more on that later, i will probably go through a big review of that). but there was one story that really didn’t make any sense to us, reading a value by key.

we started out using leveldb sharp :

database.get("users/1");

this in turn result in the following getting called:

image

a few things to note here. all from the point of view of someone who deals with very large values.

  • valueptr is not released, even though it was allocated by us.
  • we copy the value from valueptr into a string, resulting in two copies of the data and twice the memory usage.
  • there is no way to get just partial data.
  • there is no way to get binary data (for example, encrypted)
  • this is going to be putting a lot of pressure on the large object heap.

but wait, it actually gets better. let us look at the leveldb method that get called:

image

so we are actually copying the data multiple times now. for fun, the db->rep->get() call also copy the data. and that is pretty much where we stopped looking.

we are actually going to need to write a new c api and export that to be able to make use of that in our c# code. fun, or not.

LevelDB Data (computing)

Published at DZone with permission of Oren Eini, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

Popular on DZone

  • Benefits and Challenges of Multi-Cloud Integration
  • Securing Cloud-Native Applications: Tips and Tricks for Secure Modernization
  • Utilizing Database Hooks Like a Pro in Node.js
  • Browser Engines: The Crux of Cross-Browser Compatibility

Comments

Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 600 Park Offices Drive
  • Suite 300
  • Durham, NC 27709
  • support@dzone.com
  • +1 (919) 678-0300

Let's be friends: