Download free for 30 days
Sign in
Upload
Language (EN)
Support
Business
Mobile
Social Media
Marketing
Technology
Art & Photos
Career
Design
Education
Presentations & Public Speaking
Government & Nonprofit
Healthcare
Internet
Law
Leadership & Management
Automotive
Engineering
Software
Recruiting & HR
Retail
Sales
Services
Science
Small Business & Entrepreneurship
Food
Environment
Economy & Finance
Data & Analytics
Investor Relations
Sports
Spiritual
News & Politics
Travel
Self Improvement
Real Estate
Entertainment & Humor
Health & Medicine
Devices & Hardware
Lifestyle
Change Language
Language
English
Español
Português
Français
Deutsche
Cancel
Save
Submit search
EN
Uploaded by
Daehee Han
748 views
Asynchronous Python and Database
Mike Bayer의 동명의 블로그 글(http://bit.ly/1Ff6EJ1)에 대해 발표한 슬라이드입니다.
Software
◦
Read more
5
Save
Share
Embed
Embed presentation
Download
Download to read offline
1
/ 25
2
/ 25
3
/ 25
4
/ 25
5
/ 25
6
/ 25
7
/ 25
8
/ 25
9
/ 25
10
/ 25
11
/ 25
12
/ 25
13
/ 25
14
/ 25
15
/ 25
16
/ 25
17
/ 25
18
/ 25
19
/ 25
20
/ 25
21
/ 25
22
/ 25
23
/ 25
24
/ 25
25
/ 25
More Related Content
PDF
가상메모리
by
Gilsuk Hong
PDF
FCGI, C++로 Restful 서버 개발
by
현승 배
PPTX
Servlet&jsp 1장
by
JeongBong Kim
PDF
Server
by
DaeMyung Kang
PDF
Crawling with AWS Lambda
by
Seungho Kim
PDF
10만 라인, 26280시간의 이야기
by
Minyoung Jeong
PDF
두근두근 ASP.NET 5!
by
SangHoon Han
PDF
20 handler and_async_task
by
운용 최
가상메모리
by
Gilsuk Hong
FCGI, C++로 Restful 서버 개발
by
현승 배
Servlet&jsp 1장
by
JeongBong Kim
Server
by
DaeMyung Kang
Crawling with AWS Lambda
by
Seungho Kim
10만 라인, 26280시간의 이야기
by
Minyoung Jeong
두근두근 ASP.NET 5!
by
SangHoon Han
20 handler and_async_task
by
운용 최
Similar to Asynchronous Python and Database
PPTX
20180320 python3 async_io
by
Jae Hong Park
PDF
More Effective Python 3st (Multitask)
by
경섭 심
PDF
2020년 4월 4일 개발 이야기 정리
by
Jay Park
PDF
Asynchronous 101 - (1)
by
MinChul Lee
PDF
NET 최선단 기술에 의한 고성능 웹 애플리케이션
by
흥배 최
PDF
[2D4]Python에서의 동시성_병렬성
by
NAVER D2
PDF
파이콘 한국 2019 - 파이썬으로 서버를 극한까지 끌어다 쓰기: Async I/O의 밑바닥
by
Seomgi Han
PDF
MySQL Deep dive with FusionIO
by
I Goo Lee
PDF
[231]운영체제 수준에서의 데이터베이스 성능 분석과 최적화
by
NAVER D2
PDF
Multitasking on DB and Django
by
SeokhwanMoon
PDF
Windows Registered I/O (RIO) vs IOCP
by
Seungmo Koo
PPTX
Concurrent servers
by
TonyYoon12
PDF
build a linux webhosting server
by
정현 윤
PDF
검색로그시스템 with Python
by
itproman35
PDF
Python server-101
by
Huey Park
PDF
Tcp ip & io model
by
Nam Hyeonuk
PPTX
서버 아키텍처 이해를 위한 프로세스와 쓰레드
by
KwangSeob Jeong
PDF
Golang+on+analytics+and+blockchain
by
NAVER Engineering
PDF
Twitter의 대규모 시스템 운용 기술 어느 고래의 배속에서
by
흥배 최
PDF
[Pgday.Seoul 2017] 2. PostgreSQL을 위한 리눅스 커널 최적화 - 김상욱
by
PgDay.Seoul
20180320 python3 async_io
by
Jae Hong Park
More Effective Python 3st (Multitask)
by
경섭 심
2020년 4월 4일 개발 이야기 정리
by
Jay Park
Asynchronous 101 - (1)
by
MinChul Lee
NET 최선단 기술에 의한 고성능 웹 애플리케이션
by
흥배 최
[2D4]Python에서의 동시성_병렬성
by
NAVER D2
파이콘 한국 2019 - 파이썬으로 서버를 극한까지 끌어다 쓰기: Async I/O의 밑바닥
by
Seomgi Han
MySQL Deep dive with FusionIO
by
I Goo Lee
[231]운영체제 수준에서의 데이터베이스 성능 분석과 최적화
by
NAVER D2
Multitasking on DB and Django
by
SeokhwanMoon
Windows Registered I/O (RIO) vs IOCP
by
Seungmo Koo
Concurrent servers
by
TonyYoon12
build a linux webhosting server
by
정현 윤
검색로그시스템 with Python
by
itproman35
Python server-101
by
Huey Park
Tcp ip & io model
by
Nam Hyeonuk
서버 아키텍처 이해를 위한 프로세스와 쓰레드
by
KwangSeob Jeong
Golang+on+analytics+and+blockchain
by
NAVER Engineering
Twitter의 대규모 시스템 운용 기술 어느 고래의 배속에서
by
흥배 최
[Pgday.Seoul 2017] 2. PostgreSQL을 위한 리눅스 커널 최적화 - 김상욱
by
PgDay.Seoul
Asynchronous Python and Database
1.
Asynchronous Python and
Databases
2.
• Asynchronous Python
and Databases - Mike Bayer • http://bit.ly/1Ff6EJ1
4.
Sync vs Async
5.
Synchronous I/O in
Web Server • 쓰레드 : 클라이언트 = 1:1 • 코드가 간결, 확장하기 쉬움 • 라이브러리들이 모두 thread-safe 해야함
6.
Slow Client Problem
7.
해결책 : Buffering
Reverse Proxy
8.
Async I/O in
Web server • 많은 량의 I/O를 처리 • 라이브러리들이 모두 Async여야 함 • CPU intensive한 작업에 약함
9.
Async I/O in
Web Service • 예상 - evented I/O 가 thread 모델보다 빠를 것이다 • I/O intensive한 프로그램이기 때문 (DB, 캐시 조회)
10.
• 근데 안빠르다… •
대체 왜? Async I/O in Web Service
11.
Mike Bayer의 대답 (1)
Python is very slow compared to your database
12.
I/O Bound • 데이터를
요청하는 시간이 처리하는 시간보다 긴 작업 • 흔한 착각 - 웹 어플리케이션은 데이터베이스 요청이 대부분의 시간을 차지한다 • C나 자바에서는 맞는 말 • 파이썬에선 처리하는 시간도 요청하는 시간 못지 않게 오래 걸린다. (파이썬 자체가 DB에 비해 느림) • 얼마나 차이가 날까?
13.
얼마나 차이가 난다고… •
MySQL-Python (C) vs PyMySQL (Python) 로컬 연결 네트워크 연결
14.
PyMySQL benchmark (로컬)
15.
PyMySQL benchmark (네트워크) •
I/O bound라고 하기 힘듬 • 실제 어플리케이션에선 더욱더…
16.
요약하자면… • Async I/O
의 효과를 보려면 I/O bound여야 함 • 파이썬 어플리케이션 : I/O < 파이썬 자체의 오버헤드 • Async로 얻을 수 있는 효과를 감소시킴 (암달의 법칙)
17.
(2) AsyncIO uses
appealing, but relatively inefficient Python paradigms
18.
yield Overhead • 보통의
sync함수 • async 버전
19.
benchmark
20.
benchmark • 120 threads
/ processes / connection • Local Postgresql
21.
3. yield from
…
22.
3. yield from
… • explicit context switching
23.
3. yield from
… • 명시적인 컨텍스트 전환이 필요한가? - no • 왜냐하면 데이터베이스 중심 서비스는 대부분 트랜잭션을 중심으로 흘러가기 때문
24.
3. yield from
… 맞는 코드: sync를 쓰든 async를 쓰든 로직상엔 큰 차이가 없음
25.
결론 • Async I/O를
쓰지 말라는 것은 아님 • 하지만 데이터베이스 로직에는 굳이 쓸 이유가 없음 - 성능을 향상시키기보다 떨어뜨릴 확률이 높음 • Async가 적절한 상황에 nginx + uwsgi 사용
Download