-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Labels
Description
우리의 목표는 100억.. Request 최적화를 해봐요.. 아이디어 투척..
- read/recv/write/send 의 리턴값을 반드시 체크. -1, 0, 그 이상인지 모두 체크해야함.
- select() 는 read set, write set 을 한번에 체크하고 select() 이후 클라이언트 소켓별로 단 한번의 read 또는 write 를 써야만 한다.
- 단일 연결에 여러개의 요청을 처리 여부
- siege -b 명령어로 서버 부하테스트에서 99.5% 를 넘겨야함. 해당 명령어를 수행하면 무한루프가 되는데 ctrl-c 를 할때까지 멈추지 않고 계속 무한히 돌아가야함.
- config 잘못된 경로 입력시 segfault 방지
최적화
- 참조자를 잘쓰자
- 1.18
- cgi 구조에 대하여
- heap 보다는 static이 좋다. header를 읽는데 너무 큰 buffer를 읽는건 별루다. 적당한 size로 읽자.
- "Keep in mind your stack memory is a lot faster than your heap memory"
That is actually incorrect. While stack allocations can be faster, there's nothing that makes stack memory inherently faster
than heap memory, once space is allocated. The underlying access costs are the same.
Heap memory could be fragmented though, which not only incurs an access penalty but kills cache locality and
performance. In this case stack allocated memory will indeed be "a lot faster"
- "Keep in mind your stack memory is a lot faster than your heap memory"
- console.log 를 다 지우자.
string에 대하여
-
result = result + s[i]
=>result += s[i];
-
result.reserve(s.length())
미리 저장 공간을 예약하자. -
s의 포인터 역참조 제거 => iterator 사용
-
iter.end() 값 캐싱하기.
Headers
- Accept-Charsets
- Accept-Language
- Allow
- Authorization
- Content-Language
- Content-Length
- Content-Location
- Content-Type
- Date
- Host
- Last-Modified
- Location
- Referer
- Retry-After
- Server
- Transfer-Encoding
- User-Agent
- WWW-Authenticate