Don't roll your own HTTP server

Post on 09-Jan-2017

36 views 0 download

Transcript of Don't roll your own HTTP server

DON’T ROLL YOUR OWN HTTP SERVER

JOEL W KALL, CHIEF CCO OFFICER @ LOOP54

Loop54

• On-site e-commerce search engine• SaaS• Relevant search results• Machine learning

In the beginning

• Small scale prototype• Nothing fancy – just accept requests• No configuration

HTTP request-response sample

POST /path HTTP/1.1Content-Type: application/jsonContent-Length: 28

{“key”:”value”

}

HTTP/1.1 200 OKContent-Type: application/jsonContent-Length: 31

{"anotherkey":"andavalue"

}

HOLD MY BEERHOW HARD CAN IT BE?

ENCODINGHEADACHE #1

SOCKET QUEUEHEADACHE #2

CONTENT LENGTHHEADACHE #3

NAGLINGHEADACHE #4

100 CONTINUEHEADACHE #5

VERSIONINGHEADACHE #6

KEEP-ALIVE & PIPELININGTHE NAIL IN THE COFFIN

Kestrel to the resqueue

• Part of ASP.NET Core, embeddable• Cross-platform• 5% faster, 15% less memory• Full HTTP support• Probably more secure

DON’T DO IT!BUT IF YOU DO, READ UP BEFOREHAND