LevelDB 간단한 소개
Upcoming SlideShare
Loading in...5
×
 

LevelDB 간단한 소개

on

  • 5,400 views

 

Statistics

Views

Total Views
5,400
Views on SlideShare
2,111
Embed Views
3,289

Actions

Likes
1
Downloads
27
Comments
0

8 Embeds 3,289

http://ohyecloudy.com 2676
http://intranet 518
http://feeds.feedburner.com 45
http://www.hanrss.com 27
http://andstudy.com 16
http://www.andstudy.com 3
http://0.0.0.0 3
http://opnote.tistory.com 1
More...

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

LevelDB 간단한 소개 LevelDB 간단한 소개 Presentation Transcript

  • LevelDB by ohyecloudy homepage : http://ohyecloudy.com twitter : @ohyecloudy 아꿈사 : http://cafe.naver.com/architect1.cafe 2011.08.06
  • 아~ 이런 게 있구나 본 발표 목적 좀 더 쉽게 얘기하자면 ‘깊이가 없다’입니다.
  • 따끈~ 따끈~ 따끈~따끈~ 따끈~ 따끈~2011.7.27 구글 오픈소스 블로그에 공식적으로 소개따끈~ 따끈~ 따끈~따끈~ 따끈~ 따끈~따끈~ 따끈~ 따끈~
  • LevelDB는 a fast and lightweight key/value DB library 입니다.
  • LevelDB는 a fast and lightweight key/value DB library 입니다. NoSQL
  • Embedded DB e.g. SQLiteLevelDB는 a fast and lightweight key/value DB library 입니다.
  • LevelDB는 a fast and lightweight NoSQL Embedded DB key/value DB library 입니다.
  • 왜 만들었을까? 뭐땀시
  • 웹 애플리케이션용 DB 때문에 웹 애플리케이션이 저장될 캐시를 결정. 지금은 브라우저(크롬, FF, IE…)가 알아서 저장. 오프라인 대비가 잘돼서 모바일에 좋다.
  • Web SQL Database는 탈락 SQL은 웹 개발과 맞지 않다. ISO 표준이 존재하지만 벤더마다 다양한 SQL문을 지원
  • IndexedDB 가 유력 B-tree 기반 key/value 저장소 key/value면 웹 애플리케이션이 사용하기에 충분
  • LevelDB로 IndexedDB를 구현하려고
  • 맛만 살짝~LevelDB 특징 보기
  • • Keys and values are arbitrary byte arrays.• Data is stored sorted by key.• The basic operations are Put(key,value), Get(key), Delete(key).• Multiple changes can be made in one atomic batch.• Users can create a transient snapshot to get a consistent view of data.• Forward and backward iteration is supported over the data.• Data is automatically compressed using the Snappy compression library.
  • • Keys and values are arbitrary byte arrays.• Data is stored sorted by key.• The basic operations are Put(key,value), Get(key), Delete(key).• Multiple changes can be made in one atomic batch.• Users can create a transient snapshot to get a consistent view of data.• Forward and backward iteration is supported over the data.• Data is automatically compressed using the Snappy compression library.
  • std::string value;leveldb::Status s = db->Get( leveldb::ReadOptions(), key1, &value);s = db->Put( leveldb::WriteOptions(), key2, value);s = db->Delete( leveldb::WriteOptions(), key1);
  • • Keys and values are arbitrary byte arrays.• Data is stored sorted by key.• The basic operations are Put(key,value), simple key/value store와 다른 특징. Get(key), Delete(key). a persistent ordered map• Multiple changes can be made in one atomic custom comparison function 지원. batch. range query가 싸겠다.• Users can create a transient iteration이 가능 get 이런 특징 때문에 snapshot to a consistent view of data.• Forward and backward iteration is supported over the data.• Data is automatically compressed using the Snappy compression library.
  • // DB에 있는 모든 key/value 순회leveldb::Iterator* it = db->NewIterator(leveldb::ReadOptions());for (it->SeekToFirst(); it->Valid(); it->Next()){ cout << it->key().ToString() << ": “ << it->value().ToString() << endl;}
  • • Keys and values are arbitrary byte arrays.• Data is stored sorted by key.• The basic operations are Put(key,value), Get(key), Delete(key).• Multiple changes can be made in one atomic batch.• Users can create a transient snapshot to get a consistent view of data.• Forward and backward iteration is supported over the data.• Data is automatically compressed using the Snappy compression library.
  • leveldb::ReadOptions options;options.snapshot = db->GetSnapshot();//…// db를 업데이트한다.leveldb::Iterator* iter = db->NewIterator(options);// 업데이트를 하기 전 Shapshot DB를 읽는다.delete iter;db->ReleaseSnapshot(options.snapshot);
  • Fast를 붙일 만 해?
  • 전체적으로 뛰어난 성능
  • 다만 value 사이즈가 크면 성능 하락 (value 사이즈가 100,000 byte일 때 성능)구현상 key와 value를 적어도 두 번 복사하기 때문
  • 정 리
  • • LevelDB는 NoSQL Embedded DB 이다.• 웹 애플리케이션용 DB 때문에 만들었다. – IndexedDB – 다른 곳에도 더 사용하지 않을까?• key로 정렬해서 저장한다.• 전체적으로 뛰어난 성능 – value 사이즈가 크면 성능 저하
  • ReferencesLevelDB: A Fast Persistent Key-Value Storehttp://nosql-database.org/http://code.google.com/p/leveldb/http://en.wikipedia.org/wiki/Embedded_databasehttp://kldp.org/node/123247http://www.zdnet.co.kr/news/news_view.asp?artice_id=20110801100022http://xguru.net/621http://leveldb.googlecode.com/svn/trunk/doc/index.htmlhttp://leveldb.googlecode.com/svn/trunk/doc/impl.htmlhttp://leveldb.googlecode.com/svn/trunk/doc/benchmark.htmlHacker News