Your SlideShare is downloading. ×
  • Like
LevelDB 간단한 소개
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×

Now you can save presentations on your phone or tablet

Available for both IPhone and Android

Text the download link to your phone

Standard text messaging rates apply

LevelDB 간단한 소개

  • 5,545 views
Published

 

Published in Technology
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
No Downloads

Views

Total Views
5,545
On SlideShare
0
From Embeds
0
Number of Embeds
5

Actions

Shares
Downloads
29
Comments
0
Likes
4

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

  • 1. LevelDB by ohyecloudy homepage : http://ohyecloudy.com twitter : @ohyecloudy 아꿈사 : http://cafe.naver.com/architect1.cafe 2011.08.06
  • 2. 아~ 이런 게 있구나 본 발표 목적 좀 더 쉽게 얘기하자면 ‘깊이가 없다’입니다.
  • 3. 따끈~ 따끈~ 따끈~따끈~ 따끈~ 따끈~2011.7.27 구글 오픈소스 블로그에 공식적으로 소개따끈~ 따끈~ 따끈~따끈~ 따끈~ 따끈~따끈~ 따끈~ 따끈~
  • 4. LevelDB는 a fast and lightweight key/value DB library 입니다.
  • 5. LevelDB는 a fast and lightweight key/value DB library 입니다. NoSQL
  • 6. Embedded DB e.g. SQLiteLevelDB는 a fast and lightweight key/value DB library 입니다.
  • 7. LevelDB는 a fast and lightweight NoSQL Embedded DB key/value DB library 입니다.
  • 8. 왜 만들었을까? 뭐땀시
  • 9. 웹 애플리케이션용 DB 때문에 웹 애플리케이션이 저장될 캐시를 결정. 지금은 브라우저(크롬, FF, IE…)가 알아서 저장. 오프라인 대비가 잘돼서 모바일에 좋다.
  • 10. Web SQL Database는 탈락 SQL은 웹 개발과 맞지 않다. ISO 표준이 존재하지만 벤더마다 다양한 SQL문을 지원
  • 11. IndexedDB 가 유력 B-tree 기반 key/value 저장소 key/value면 웹 애플리케이션이 사용하기에 충분
  • 12. LevelDB로 IndexedDB를 구현하려고
  • 13. 맛만 살짝~LevelDB 특징 보기
  • 14. • 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.
  • 15. • 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.
  • 16. 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);
  • 17. • 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.
  • 18. // 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;}
  • 19. • 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.
  • 20. leveldb::ReadOptions options;options.snapshot = db->GetSnapshot();//…// db를 업데이트한다.leveldb::Iterator* iter = db->NewIterator(options);// 업데이트를 하기 전 Shapshot DB를 읽는다.delete iter;db->ReleaseSnapshot(options.snapshot);
  • 21. Fast를 붙일 만 해?
  • 22. 전체적으로 뛰어난 성능
  • 23. 다만 value 사이즈가 크면 성능 하락 (value 사이즈가 100,000 byte일 때 성능)구현상 key와 value를 적어도 두 번 복사하기 때문
  • 24. 정 리
  • 25. • LevelDB는 NoSQL Embedded DB 이다.• 웹 애플리케이션용 DB 때문에 만들었다. – IndexedDB – 다른 곳에도 더 사용하지 않을까?• key로 정렬해서 저장한다.• 전체적으로 뛰어난 성능 – value 사이즈가 크면 성능 저하
  • 26. 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