dynamodb 삽질기
TRANSCRIPT
Dynamodb 삽질기김승연(Acuros) / 최보철(Teddy)
Dynamodb 매우 삽질기김승연(Acuros) / 최보철(Teddy)
서브 프로젝트
•Nginx
•CPython 2.7
•uwsgi
•django
•mysql
•Nginx
•Pypy
•Gunicorn + eventlet
•Flask
•Dynamodb
Dynamodb
•NoSQL
•유연한 throughput
•설치 필요 없음
• Mongodb 16mb > Dynamodb 400kb
• Index를 바꿀 수 없음
• Boto를 못만들었음
시작부터 난관
로컬에서 어떻게 테스트하지?
Sqlite + HTTP Server(http://aws.amazon.com/ko/blogs/aws/dynamodb-local-for-desktop-development/ 2013.09.12)
로컬에 연결은 어떻게 하지?
boto
망할 boto
boto.dynamodbboto.dynamodb2
???Connection은 ???
Boto config
Region만 입력할 수 있다
1. Hosts 수정
2. boto.endpoints_path 수정
3. AWS real server에 테스트하기
4. 그만두기
1. Hosts 수정
2. boto.endpoints_path 수정
3. AWS real server에 테스트하기
4. 그만두기
포트는?
1. 테스트 DB 서버를 sudo로
2. Iptables로 port redirection
3. 다른 방법 찾아보기
4. 그만두기
1. 테스트 DB 서버를 sudo로
2. Iptables로 port redirection
3. 다른 방법 찾아보기
4. 그만두기
boto
망할 boto
Table(table_name, schema=None, throughput=None, indexes=None, global_indexes=None, connection=None)
Optionally accepts a connection parameter, which should be a DynamoDBConnection instance (or subclass). This is primarily useful for specifying alternate connection parameters.
Table('User', connection)
이게 뭐야
1. 매번 Table(name, connection)
2. Monkey patching
3. 그만두기
1. 매번 Table(name, connection)
2. Monkey patching
3. 그만두기
Table(table_name, schema=None, throughput=None, indexes=None, global_indexes=None, connection=None)
Optionally accepts a connection parameter, which should be a DynamoDBConnection instance (or subclass). This is primarily useful for specifying alternate connection parameters.
DynamoDBConnection.init monkey patching
app.config host, port, is_secure 우선순위
39슬라이드만에테스트를 할 수 있게 되었다
이제 본격적인 개발코드를작성해볼까
…불편하다
1. schemaless
• user[‘likes’] ? user[‘like’]?
• type(user[‘likes’] == list)? type(user[‘likes’] == set)?
42
2. Document type support
43
3. Complex Lookup
46
누군가는 이것들을해결해놨을거야!
있다! Schema!
해결!
..망할 PynamoDB
boto와 연관없는 자체 구현
하지만
1. DynamoDB 명세를 모두 구현하지 않음
• Complex Lookup 기능이 존재하지 않음
• 자체구현임에도 불구하고 List, Map Type을 구현하지 않음
55
2. 다른 Library들과 호환되지 않는 동작
56
• Set type을 문자열로 저장해서 사용
1. Boto와 PynamoDB 같이 쓰기
2. PynamoDB를 수정해서 쓰기
3. Boto wrapping을 구현하기
4. 그만두기
1. Boto와 PynamoDB 같이 쓰기
2. PynamoDB를 수정해서 쓰기
3. Boto wrapping을 구현하기
4. 그만두기
BynamoDBhttps://github.com/teddychoi/BynamoDB
1. Boto의 저수준 인터페이스 감쌈
2. 스키마 정의
3. 복잡한 조건검색 지원
4. 어느 호스트에도 쉽게 접속 가능
61
Before
62
After
63
Before
After
QNA