NoSQL

Similar documents
PowerPoint 프레젠테이션

Connection 8 22 UniSQLConnection / / 9 3 UniSQL OID SET

<C0CCBCBCBFB52DC1A4B4EBBFF82DBCAEBBE7B3EDB9AE2D D382E687770>

1217 WebTrafMon II

DocsPin_Korean.pages

Analytics > Log & Crash Search > Unity ios SDK [Deprecated] Log & Crash Unity ios SDK. TOAST SDK. Log & Crash Unity SDK Log & Crash Search. Log & Cras

11 템플릿적용 - Java Program Performance Tuning (김명호기술이사)

Oracle Database 10g: Self-Managing Database DB TSC

10.ppt

rmi_박준용_final.PDF

신림프로그래머_클린코드.key

Microsoft PowerPoint - CNVZNGWAIYSE.pptx

Interstage5 SOAP서비스 설정 가이드

ORANGE FOR ORACLE V4.0 INSTALLATION GUIDE (Online Upgrade) ORANGE CONFIGURATION ADMIN O

목차 BUG offline replicator 에서유효하지않은로그를읽을경우비정상종료할수있다... 3 BUG 각 partition 이서로다른 tablespace 를가지고, column type 이 CLOB 이며, 해당 table 을 truncate

FileMaker ODBC and JDBC Guide

Intra_DW_Ch4.PDF

목 차

PowerPoint Presentation

ETL_project_best_practice1.ppt

Mobile Service > IAP > Android SDK [ ] IAP SDK TOAST SDK. IAP SDK. Android Studio IDE Android SDK Version (API Level 10). Name Reference V

untitled

MySQL-Ch10

11강-힙정렬.ppt

13주-14주proc.PDF

교육2 ? 그림

목차 BUG DEQUEUE 의 WAIT TIME 이 1 초미만인경우, 설정한시간만큼대기하지않는문제가있습니다... 3 BUG [qp-select-pvo] group by 표현식에있는컬럼을참조하는집합연산이존재하지않으면결괏값오류가발생할수있습니다... 4

歯JavaExceptionHandling.PDF

초보자를 위한 분산 캐시 활용 전략

T100MD+

thesis

2

PowerPoint 프레젠테이션


SMB_ICMP_UDP(huichang).PDF

歯sql_tuning2

FileMaker ODBC 및 JDBC 가이드

untitled

MS-SQL SERVER 대비 기능

PowerPoint 프레젠테이션

Yggdrash White Paper Kr_ver 0.18

The Self-Managing Database : Automatic Health Monitoring and Alerting

@OneToOne(cascade = = "addr_id") private Addr addr; public Emp(String ename, Addr addr) { this.ename = ename; this.a

Smart Power Scope Release Informations.pages

휠세미나3 ver0.4

Spring Boot/JDBC JdbcTemplate/CRUD 예제

I T C o t e n s P r o v i d e r h t t p : / / w w w. h a n b i t b o o k. c o. k r


02 C h a p t e r Java

FileMaker 15 ODBC 및 JDBC 설명서

ilist.add(new Integer(1))과 같이 사용하지 않고 ilist.add(1)과 같이 사용한 것은 자바 5.0에 추가된 기본 자료형과 해당 객체 자료 형과의 오토박싱/언박싱 기능을 사용한 것으로 오토박싱이란 자바 컴파일러가 객체를 요구하는 곳에 기본 자료형

3 S Q L A n t i p a t t e r n s Trees/intro/parent.sql CREATE TABLE Comments ( comment_id SERIAL PRIMARY KEY, parent_id BIGINT UNSIGNED, comment TEXT

FileMaker ODBC and JDBC Guide

결과보고서

CD-RW_Advanced.PDF

8 장데이터베이스 8.1 기본개념 - 데이터베이스 : 데이터를조직적으로구조화한집합 (cf. 엑셀파일 ) - 테이블 : 데이터의기록형식 (cf. 엑셀시트의첫줄 ) - 필드 : 같은종류의데이터 (cf. 엑셀시트의각칸 ) - 레코드 : 데이터내용 (cf. 엑셀시트의한줄 )

manual pdfÃÖÁ¾

R50_51_kor_ch1

No Slide Title

12-file.key

PowerPoint 프레젠테이션

개요오라클과티베로에서 JDBC 를통해접속한세션을구분할수있도록 JDBC 접속시 ConnectionProperties 를통해구분자를넣어줄수있다. 하나의 Node 에다수의 WAS 가있을경우 DB 에서 Session Kill 등의동작수행시원하는 Session 을선택할수있다.

untitled

목차 1. 제품 소개 특징 개요 Function table 기능 소개 Copy Compare Copy & Compare Erase

PowerPoint Presentation

LCD Display

쉽게 풀어쓴 C 프로그래밊

MySQL-Ch05

Web Application Hosting in the AWS Cloud Contents 개요 가용성과 확장성이 높은 웹 호스팅은 복잡하고 비용이 많이 드는 사업이 될 수 있습니다. 전통적인 웹 확장 아키텍처는 높은 수준의 안정성을 보장하기 위해 복잡한 솔루션으로 구현

untitled

API STORE 키발급및 API 사용가이드 Document Information 문서명 : API STORE 언어별 Client 사용가이드작성자 : 작성일 : 업무영역 : 버전 : 1 st Draft. 서브시스템 : 문서번호 : 단계 : Docum

mytalk

<30362E20C6EDC1FD2DB0EDBFB5B4EBB4D420BCF6C1A42E687770>

untitled

歯처리.PDF

No Slide Title

DBPIA-NURIMEDIA

github_introduction.key

Chap7.PDF

RED HAT JBoss Data Grid (JDG)? KANGWUK HEO Middleware Solu6on Architect Service Team, Red Hat Korea 1

Oracle9i Real Application Clusters

chapter4

3ÆÄÆ®-11

2 / 26

MongoDB Trends and Introduction 우정웅연구원 Dec. 02, 2014

example code are examined in this stage The low pressure pressurizer reactor trip module of the Plant Protection System was programmed as subject for

제목을 입력하세요.

PowerPoint 프레젠테이션

Microsoft PowerPoint - Supplement-03-TCP Programming.ppt [호환 모드]

목차 INDEX JSON? - JSON 개요 - JSONObject - JSONArray 서울시공공데이터 API 살펴보기 - 요청인자살펴보기 - Result Code - 출력값 HttpClient - HttpHelper 클래스작성 - JSONParser 클래스작성 공공

PowerChute Personal Edition v3.1.0 에이전트 사용 설명서

ARMBOOT 1

Microsoft PowerPoint - 03-TCP Programming.ppt

160215

RUCK2015_Gruter_public

슬라이드 1

fundamentalOfCommandPattern_calmglow_pattern_jstorm_1.0_f…

슬라이드 1

JMF3_심빈구.PDF

자바-11장N'1-502

Transcription:

MongoDB Daum Communications

NoSQL

Using Java Java VM, GC Low Scalability Using C Write speed Auto Sharding High Scalability Using Erlang Read/Update MapReduce R/U MR Cassandra Good Very Good MongoDB Good Poor but Scalable Cassandra 153% 112% MongoDB 145% 211%

MongoDB?

MyAgora

60,000K 52,445,415 45,000K 32,445,415 30,000K 24,350,302 18,925,573 15,000K 4,596,409 8,445,415 13,605,034 0...... 2011-01 2011-02 2011-03 2011-04 2011-05 2011-08 2012-01

Needs NoSQL!! Legacy Too many inserts Short period

$mysql->query("alter TABLE test ADD INDEX idx_id(id)"); for($i = 0 ; $i < $limit ; $i++) { $q = "insert into test values($i,'$i')"; $mysql->query($q); } for($i = 0 ; $i < $limit ; $i++) { $q = "select * from test where id = $i"; if ($result = $mysql->query($q)) while ($row = $result->fetch_assoc()) {} } for($i = 0 ; $i < $limit ; $i++) { $q = "update test set value = '$i$i' where id = $i"; $mysql->query($q); } for($i = 0 ; $i < $limit ; $i++) { $q = "delete from test where id = $i"; $mysql->query($q); } $col->ensureindex(array("id"=>1)) for($i = 0 ; $i < $limit ; $i++) { $col->insert(array("id"=>$i,"value"=>"$i")); } for($i = 0 ; $i < $limit ; $i++) { $c = $col->find(array("id"=>$i))->hint(array ("id"=>-1))->limit(1); foreach($c as $a) {} } for($i = 0 ; $i < $limit ; $i++) { $col->update(array("id"=>$i), array('$set'=>array ("value"=>"$i$i"))); } for($i = 0 ; $i < $limit ; $i++) { $col->remove(array("id"=>$i)); } 1,000,000 Data Insert/Select/Update/Delete Performance Insert Select Update Delete MySQL 249.39 sec 354.82 sec 316.82 sec 310.37 sec MongoDB 59.37 sec 293.99 sec 153.39 sec 123.34 sec

My

MyAgora

Agora MYSQL Disk Disk MyAgora 2011-02-07 205,874 2011-02-08 220,909 2011-02-09 184,568 Agent Mongo DB Mongo DB Mongo DB

Backup & Recovery

fsync and lock Data dumping (mongodump) Backup Shutdown backup Data export (mongoexport)

04:00AM Latest Mongo DB Daily Backup Server Mongo DB Mongo DB Weekly Monthly

All Master Backup file Mongorestore Master Slave to Master Server Slave Server Sync Slaves Server

Practical Tips

Data Modeling Index Performance

Schemaless RDB Data Join Application Mashup

Index

B-tree 1 Query - 1 Index Wrong/No index hint() High disk IO Memory Size Too big index Compound index Need Sharding

findone(query) find(query).hint(index).limit(1) Log Scale 10000 findone find.hint 5.493 3.443 3.494 1000 3.970 3.610 100 10 0.032 0.030 0.025 0.030 0.015 1 5 / 6.64G 4 / 4.84G 3 / 3.74G 2 / 2.1G 1 / 1.38G

Performance

Connection Singleton Pattern Connection Pooling slaveok()

[ERROR] 2010-11-17 14:19:24 org.apache.catalina.core.standardwrappervalve.invoke (StandardWrapperValve.java:253)-Servlet.service() for servlet dispatcher threw exception com.mongodb.mongointernalexception: can't find a master at com.mongodb.dbtcpconnector.checkmaster(dbtcpconnector.java:327) at com.mongodb.mongo.<init>(mongo.java:215) at com.mongodb.mongo.<init>(mongo.java:200) Caused by: com.mongodb.mongoexception$network: can't call something at com.mongodb.dbtcpconnector.call(dbtcpconnector.java:210) at com.mongodb.dbtcpconnector.call(dbtcpconnector.java:208) at com.mongodb.dbtcpconnector.call(dbtcpconnector.java:208) at com.mongodb.dbapilayer$mycollection. find(dbapilayer.java:256) at com.mongodb.dbcollection.findone(dbcollection.java:467) at com.mongodb.dbcollection.findone(dbcollection.java:456)

private static MongoDBConnection instance = null; private static Mongo m = null; private MongoDBConnection() { try { List<ServerAddress> mongodbhosts = getmongodbhosts(); if (mongodbhosts.size() == 1) { m = new Mongo(mongodbHosts.get(0)); } else { m = new Mongo(mongodbHosts); } m.slaveok(); } catch (UnknownHostException e) { e.printstacktrace(); } } private static List<ServerAddress> getmongodbhosts() throws UnknownHostException { String hostspop = mongodbprop.getstring(key_mongodb_hosts); String [] hostsarray = StringUtils.split(hostsPop, ","); String port = getmongodbport(); List<ServerAddress> hosts = new LinkedList<ServerAddress>(); for (String host : hostsarray) { hosts.add(new ServerAddress(host.concat(":").concat(port))); } return hosts; }

Cursor Timeout Exception batchsize count() vs cursor.size() count() cursor.size() 0.537 sec 0.158 sec

$cursor->limit(30)->batchsize(7) // if we iterate through 28 items, the next call to getnext() will contact the // database and request a batch of 2 documents $cursor =$relationshipcollection->find()->limit()->hint(); while($cursor->hasnext()){ $relationship = $cursor->getnext(); } $batchsize = 1000; $cursor = $relationshipscollection->find()->hint(); $cursor = $cursor->batchsize($batchsize); while($cursor->hasnext()){ $relationship = $cursor->getnext(); }

Update Object update Atomic update Reindexing update() update($set) 0.387 sec 0.032 sec

public void updatemy(my my, String intro) { BasicDBObject query = new BasicDBObject(); query.put(key_daum_id, my.daumid); query.put(key_cp_code, my.cpcode); my.intro = intro; DBObject dbo = MongoDBUtil.toDB(my); DBCollection col = MongoDBUtil.getProfileCollection(); col.update(query, dbo); } public void updatemy(my my, String intro) { BasicDBObject query = new BasicDBObject(); query.put(key_daum_id, my.daumid); query.put(key_cp_code, my.cpcode); DBCollection col = MongoDBUtil.getProfileCollection(); DBObject dbo = MongoDBUtil.toDB(my); col.update(query, new BasicDBObject("$set", new BasicDBObject("intro", intro))); }

Data file 64mb -> 128mb -> 256mb -> 512mb -> 1.0gb -> 2.0gb db.repairdatabase() 1. Data 30GB 2. Data => Data 30GB 3. Data Insert => If(inserted Data > 30GB) then Data

DB Profiling Slow Query system.profile Only latest operations

Level Setting 0 off 1 log slow operations 2 log all operations > use admin switched to db admin > db.setprofilinglevel(2); { "was" : 0, "slowms" : 50, "ok" : 1 } > db.setprofilinglevel(1, 200); { "was" : 2, "slowms" : 50, "ok" : 1 } > db.system.profile.find({millis : { $gt : 5 }}) {"ts" : "Thu Jan 29 2009 15:21:27 GMT-0500 (EST)", "info" : "query test.foo ntoreturn:0 exception bytes: 53", "millis" : 88}

Full table scan Wrong Index mongodb.conf count() logpath=/daum/logs/mongodb.log logappend=true replset=mongoset1 notablescan=true > db.articles.find({"classname":""}); error: { "$err" : "table scans not allowed:test.articles", "code" : 10111 }

OR Mapper (JB)Son <-> Object Morphia @preload @postload @notsaved

Tools

Rock Mongo

Rock Mongo

mongostat

mongostat

Compatible Light Transaction Log type data Area / MongoDB More Data Modeling Sharding

Thanks rockfactory@daumcorp.com