You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
[level2에서 진행한 okhttp 성능개선 실험 블로그글](https://mccoy-devloper.tistory.com/127)
okHttp의 쓰레드 디폴트 쓰레드는 한 호스트당 size5 짜리 queue를 사용하고 있고 이는 호스트가 여러개를 사용하지 않는 이상 OkHttp 객체의 자원을 제한하고 사용하는 형태이다.
실험의 경우 극단적인 형태로 request양을 늘려서 실험하는 형태여서 실제 앱과 똑같은 환경은 아니지만 maxRequest, maxRequestsPerHost를 늘리면 처리 성능이 늘어나는 경향을 보인다.
1차실험(maxRequest,maxRequestsPerHost default 사용)
Enqueue(okHttp) 1000 번 5회
1회차: enqueue with CountDownLatch : 13443
2회차: enqueue with CountDownLatch : 12335
3회차: enqueue with CountDownLatch : 14532
4회차: enqueue with CountDownLatch : 16644
5회차: enqueue with CountDownLatch : 14901
2차실험(maxRequest = 100, maxRequestsPerHost default = 100)
Enqueue(okHttp) 1000 번 5회
1회차: enqueue with CountDownLatch : 10791
2회차: enqueue with CountDownLatch : 10112
3회차: enqueue with CountDownLatch : 10844
4회차: enqueue with CountDownLatch : 12104
5회차: enqueue with CountDownLatch : 11233
3차실험(maxRequest = 120, maxRequestsPerHost default = 120)
Enqueue(okHttp) 1000 번 5회
1회차: enqueue with CountDownLatch : 9458
2회차: enqueue with CountDownLatch : 8801
3회차: enqueue with CountDownLatch : 7439
4회차: enqueue with CountDownLatch : 7978
5회차: enqueue with CountDownLatch : 7601
Okhttp 성능 개선을 위해 maxRequestsPerHost를 조정하였다.
최초 계획은 TripDraw에서 서버를 2대 사용하기 때문에 default MaxRequestPerHost의 절반인 32로 조정하려 했지만
변수가 많을 수 있기 때문에 보수적으로 기본값인 5의 두배인 10으로 조정하였다.
Beta Was this translation helpful? Give feedback.
All reactions