Python에서 멀티 스레드를 사용하지 않는 이유(Java와 비교, GIL)
·
Python
파이썬에서 멀티 스레드를 잘 사용하지 않습니다. 대부분 멀티 프로세싱을 사용합니다. 그 이유가 뭘까요?핵심만 먼저 말하자면, 병렬성이 제대로 이뤄지지 않기 때문입니다. CPU 코어가 남는 경우, 스레드는 병렬적으로 실행되게 됩니다. 반대로 코어가 하나만 있다면 순차적으로 실행됩니다. 그런데 파이썬은 어떠한 조건에서도 멀티 스레드가 순차적으로 실행되는 모습을 보여줍니다. 한번 테스트를 해볼까요? Python 멀티 스레드 테스트import threadingimport timedef thread():    start = time.time()    a = 1    for i in range(10000000):        a += i    print(threading.current_thread().name,":..
Python WSGI 서버 직접 만들어보기
·
Python
안녕하세요. 오늘은 WSGI 서버를 직접 만들어보도록 하겠습니다. 이전에 WSGI가 무엇인지에 대해서 다뤘습니다. 이때에는 간단하게 WSGI 애플리케이션도 만들어보았었습니다. GitHub에 전체코드를 올려두었습니다! GitHub - fhdufhdu/MyGunicorn: WSGI 서버를 만들어보자!!! 최대한 Gunicorn 처럼 만드는 것이 목표임!WSGI 서버를 만들어보자!!! 최대한 Gunicorn 처럼 만드는 것이 목표임! Contribute to fhdufhdu/MyGunicorn development by creating an account on GitHub.github.com  2024.05.28 - [Python] - Python WSGI란? Python WSGI란?안녕하세요. 오늘은 파이썬..
Python WSGI란?
·
Python
안녕하세요. 오늘은 파이썬의 웹 서버 인터페이스인 WSGI에 대해서 알아보도록 하겠습니다.WSGIWSGI(Web Server Gateway Interface) 정의 WSGI — WSGI.orgContributing Found a typo? Or some awkward wording? Want to add a link to a presentation, a tutorial or a new (or old and missing) WSGI-related tool? Fixing a dead link? WSGI.org is open-source and hosted on github, contributions are encouraged and appreciwsgi.readthedocs.ioWSGI는 웹 서버와 웹 애플..