SlideShare a Scribd company logo
1 of 83
Download to read offline
Dexador Rises
Lisp Meet Up #31
August 26, 2015
Eitaro Fukamachi
Somewrite Co., Ltd.
I’m Eitaro Fukamachi
@nitro_idiot fukamachi
My Products
• Clack
• Caveman2
• Woo
• quickdocs.org
• Qlot
Contributing
• Roswell
We Work Remotely
We Work Remotely
We’re hiring!
Today,
let me talk about HTTP client.
HTTP client
Client Server
HTTP client
Client Server
HTTP Request
GET / HTTP/1.1
Host: quickdocs.org
User-Agent: curl/7.43.0
Accept: */*
HTTP client
Client Server
HTTP Request
HTTP Response
GET / HTTP/1.1
Host: quickdocs.org
User-Agent: curl/7.43.0
Accept: */*
HTTP/1.1 200 OK
Date: Mon, 24 Aug 2015 00:41:36 GMT
Content-Type: text/html
Content-Length: 3771
Connection: keep-alive
HTTP client
Client Server
HTTP Request
HTTP Response
GET / HTTP/1.1
Host: quickdocs.org
User-Agent: curl/7.43.0
Accept: */*
HTTP/1.1 200 OK
Date: Mon, 24 Aug 2015 00:41:36 GMT
Content-Type: text/html
Content-Length: 3771
Connection: keep-alive
ex) Google Chrome, curl, Drakma ex) Apache, nginx, Woo
HTTP client libraries
• Drakma
• trivial-http
• Carrier
HTTP client libraries
• Drakma
• De facto. Full-featured.
• trivial-http
• Simple. A few features. No SSL.
• Carrier
• Asynchronous.
HTTP client libraries
• Drakma (usocket)
• De facto. Full-featured.
• trivial-http (usocket)
• Simple. A few features. No SSL.
• Carrier (cl-async/libuv)
• Asynchronous.
HTTP client libraries
• Drakma (usocket)
• De facto. Full-featured.
• trivial-http (usocket)
• Simple. A few features. No SSL.
• Carrier (cl-async/libuv)
• Asynchronous.
75
LIBRARIES
Required by
3
LIBRARIES
None
Drakma
• Ediware
• Since 2006
• Still maintained at GitHub
Mature??? Easy to use??? Fast???
No.
Pitfall 1:
Force URL encoding
• Force URL encoding with PURI
Pitfall (1/3) of Drakma
(drakma:http-request
(format nil “http://b.hatena.ne.jp/search/tag?q=~A”
tag))
tag = “lisp” => OK
tag = “scheme” => OK
tag = “clojure” => OK
tag = “common lisp” => PURI:URI-PARSE-ERROR
• Force URL encoding with PURI
Pitfall (1/3) of Drakma
(drakma:http-request
(format nil “http://b.hatena.ne.jp/search/tag?q=~A”
(drakma:url-encode tag :utf-8)))
tag = “lisp” => OK
tag = “scheme” => OK
tag = “clojure” => OK
tag = “common lisp” => “common+lisp”
• Force URL encoding with PURI
Pitfall (1/3) of Drakma
(drakma:http-request
(format nil “http://b.hatena.ne.jp/search/tag?q=~A”
(drakma:url-encode tag :utf-8)))
tag = “lisp” => OK
tag = “scheme” => OK
tag = “clojure” => OK
tag = “common lisp” => “common+lisp”
tag = “AKB48” => OK
tag = “乃木坂46” => "%E4%B9%83%E6%9C%A8%E5%9D%8246"
• Force URL encoding with PURI
Pitfall (1/3) of Drakma
(drakma:http-request
(format nil “http://b.hatena.ne.jp/search/tag?q=~A”
(drakma:url-encode tag :utf-8))
:preserve-uri t)
tag = “lisp” => OK
tag = “scheme” => OK
tag = “clojure” => OK
tag = “common lisp” => OK
tag = “AKB48” => OK
tag = “乃木坂46” => OK
Pitfall 2:
Poor language support
• Poor language support with flexi-streams
Pitfall (2/3) of Drakma
(drakma:http-request “http://www.hatena.ne.jp/”)
(drakma:http-request “http://www.google.co.jp/”)
• Poor language support with flexi-streams
Pitfall (2/3) of Drakma
(drakma:http-request “http://www.hatena.ne.jp/”)
;; => body as UTF-8 string
(drakma:http-request “http://www.google.co.jp/”)
;; => body as byte vector
WARNING: Problems determining charset (falling back to binary):
:SHIFT_JIS is not known to be a name for an external format.
Pitfall 3:
Error handling
• Tend to forget error handling
Pitfall (3/3) of Drakma
(let* ((body (drakma:http-request “http://cliki.net”))
(parsed-html (plump:parse body)))
…)
• Tend to forget error handling
Pitfall (3/3) of Drakma
(let* ((body (drakma:http-request “http://cliki.net”))
(parsed-html (plump:parse body)))
…)
It fails if the HTTP response code is 4xx or 5xx.
• Tend to forget error handling
Pitfall (3/3) of Drakma
(multiple-value-bind (body status)
(drakma:http-request “http://cliki.net”)
(unless (= status 200)
(error “An HTTP request failed (Code=~D)”
status))
(let ((parsed-html (plump:parse body)))
…))
Raise an error unless the status is not 200
• Tend to forget error handling
Pitfall (3/3) of Drakma
(multiple-value-bind (body status)
(drakma:http-request “http://cliki.net”)
(unless (= status 200)
(error “An HTTP request failed (Code=~D)”
status))
(let ((parsed-html (plump:parse body)))
…))
Raise an error unless the status is not 200
Want to retry???
• Tend to forget error handling
Pitfall (3/3) of Drakma
(block nil
(tagbody
retry
(multiple-value-bind (body status)
(drakma:http-request "http://cliki.net/")
(unless (= status 200)
(go retry))
(return body))))
With Auto-Retrying
• Tend to forget error handling
Pitfall (3/3) of Drakma
(block nil
(let ((times 5))
(tagbody
retry
(multiple-value-bind (body status)
(drakma:http-request "http://cliki.net/")
(unless (= status 200)
(when (= times 0)
(error "An HTTP request failed. (Code=~D)”
status))
(decf times)
(go retry))
(return body)))))
Retry only 5 times
Many pitfalls.
Ridiculous.
We just wanted to
send an HTTP request.
Dexador changes it.
• Full-featured. usocket based.
• Use fast-http, QURI, Babel, cl-cookie
Dexador: Another choice
Dexador: APIs
(dex:get “http://lisp.org/“)
(dex:post “http://lisp.org/“)
(dex:head “http://lisp.org/“)
(dex:put “http://lisp.org/“)
(dex:delete “http://lisp.org/“)
Dexador: Language support
;; Shift_JIS
(dex:get “http://www.google.co.jp/“)
;; EUC-JP
(dex:get “https://mixi.jp/“)
Dexador: Error handling
(handler-case (dex:get “http://cliki.net/“)
(dex:http-request-failed (e)
(warn “An HTTP request failed (Code=~D)”
(dex:response-status e))))
Dexador: Error handling
(handler-case (dex:get “http://cliki.net/“)
(dex:http-request-forbidden ()
;; for 403 forbidden
)
(dex:http-request-service-unavailable ()
;; for 503 service unavailable
)
(dex:http-request-failed (e)
(warn “An HTTP request failed (Code=~D)”
(dex:response-status e))))
Dexador: Error handling
;; Ignore errors and continue
(handler-bind ((dex:http-request-failed
#'dex:ignore-and-continue))
(dex:get "http://lisp.org"))
Dexador: Auto-Retrying
;; Auto-retry on 503 error
(handler-bind ((dex:http-request-service-unavailable
#’dex:retry-request))
(dex:get "http://lisp.org"))
Dexador: Auto-Retrying
;; Retry only 5 times
(handler-bind ((dex:http-request-service-unavailable
(dex:retry-request 5)))
(dex:get "http://lisp.org"))
Dexador: Auto-Retrying
;; Retry only 5 times at 3-second intervals
(handler-bind ((dex:http-request-service-unavailable
(dex:retry-request 5 :interval 3)))
(dex:get "http://lisp.org"))
Dexador: Auto-Retrying
;; Retry only 5 times at 3-second intervals
(handler-bind ((dex:http-request-service-unavailable
(dex:retry-request 5 :interval 3)))
(dex:get "http://lisp.org"))
(block nil
(let ((times 5))
(tagbody
retry
(multiple-value-bind (body status)
(drakma:http-request "http://cliki.net/")
(unless (= status 200)
(when (= times 0)
(error "An HTTP request failed. (Code=~D)”
status))
(decf times)
(sleep 3)
(go retry))
(return body)))))
Dexador
Drakma
You may ask…
You may ask…
…is it fast?
Benchmark
Sending GET request 30 times to Local Server

(lower is better)
0
0.009
0.018
0.026
0.035
Drakma Dexador

w/out conneciton-pool
0.024s
Benchmark
Sending GET request 30 times to Local Server

(lower is better)
0
0.009
0.018
0.026
0.035
Drakma Dexador

w/out conneciton-pool
0.013s
0.024s
Sending GET request 30 times to Local Server

(lower is better)
0
0.009
0.018
0.026
0.035
Drakma Dexador

w/out conneciton-pool
0.013s
0.024s
Benchmark
x1.8 faster!
Sending GET request 30 times to Local Server

(lower is better)
0
0.009
0.018
0.026
0.035
Drakma Dexador

w/out conneciton-pool
0.013s
0.024s
Benchmark
x1.8 faster!????
How about requesting
over network?
Benchmark
Sending GET request 30 times to Remote Server

(lower is better)
0
0.15
0.3
0.45
0.6
Drakma Dexador

w/out conneciton-pool
0.505s
Benchmark
Sending GET request 30 times to Remote Server

(lower is better)
0
0.15
0.3
0.45
0.6
Drakma Dexador

w/out conneciton-pool
0.396s
0.505s
Benchmark
Sending GET request 30 times to Remote Server

(lower is better)
0
0.15
0.3
0.45
0.6
Drakma Dexador

w/out conneciton-pool
0.396s
0.505s x1.2 faster
Benchmark
Sending GET request 30 times to Remote Server

(lower is better)
0
0.15
0.3
0.45
0.6
Drakma Dexador

w/out conneciton-pool
0.396s
0.505s 0.0036 sec/req
Benchmark
Sending GET request 30 times to Remote Server

(lower is better)
0
0.15
0.3
0.45
0.6
Drakma Dexador

w/out conneciton-pool
0.396s
0.505s 0.0036 sec/req
Too trivial improvement…
How come?
Benchmark
Sending GET request 30 times to Remote Server

(lower is better)
0
0.15
0.3
0.45
0.6
Drakma Dexador

w/out conneciton-pool
0.396s
0.505s
Benchmark
Sending GET request 30 times to Remote Server

(lower is better)
0
0.15
0.3
0.45
0.6
Drakma Dexador

w/out conneciton-pool
0.396s
0.505s
Network Latency
+
Connection
establishment
Network Latency
+
Connection
establishment
Benchmark
Sending GET request 30 times to Remote Server

(lower is better)
0
0.15
0.3
0.45
0.6
Drakma Dexador

w/out conneciton-pool
0.396s
0.505s
Network Latency
+
Connection
establishment
Network Latency
+
Connection
establishment
The largest bottleneck
Differences of Servers/Clients
HTTP Server HTTP Client
C
S
C C
C
S
Can’t help
Network Latency and
bandwidth.
Can skip
connection establishment…?
• Reuse connections once established
(Implicit) Connection-pooling
• Reuse connections once established
(Implicit) Connection-pooling
;; Establish a new connection
(dex:get “http://lisp.org/index.html“)
;; Reuse the above connection
(dex:get “http://lisp.org/index.html“)
• Reuse connections once established
(Implicit) Connection-pooling
;; Establish a new connection
(dex:get “http://lisp.org/index.html“)
;; Reuse the above connection
(dex:get “http://lisp.org/index.html“)
0.727 sec
0.380 sec
Benchmark (again)
Benchmark
Sending GET request 30 times to Local Server

(lower is better)
0
0.006
0.012
0.018
0.024
Drakma Dexador

w/out conneciton-pool
Dexador

w/ connection-pool
0.013s
0.024s
Benchmark
Sending GET request 30 times to Local Server

(lower is better)
0
0.006
0.012
0.018
0.024
Drakma Dexador

w/out conneciton-pool
Dexador

w/ connection-pool
0.005s
0.013s
0.024s
Benchmark
Sending GET request 30 times to Local Server

(lower is better)
0
0.006
0.012
0.018
0.024
Drakma Dexador

w/out conneciton-pool
Dexador

w/ connection-pool
0.005s
0.013s
0.024s
x4.8 faster!
Benchmark
Sending GET request 30 times to Remote Server

(lower is better)
0
0.15
0.3
0.45
0.6
Drakma Dexador

w/out conneciton-pool
Dexador

w/ connection-pool
0.396s
0.505s
Benchmark
Sending GET request 30 times to Remote Server

(lower is better)
0
0.15
0.3
0.45
0.6
Drakma Dexador

w/out conneciton-pool
Dexador

w/ connection-pool
0.219s
0.396s
0.505s
Benchmark
Sending GET request 30 times to Remote Server

(lower is better)
0
0.15
0.3
0.45
0.6
Drakma Dexador

w/out conneciton-pool
Dexador

w/ connection-pool
0.219s
0.396s
0.505s Still x2.3 faster!
• It’s pretty common to request to the same
host multiple times
• Can expect some performance
improvements in real applications
In real applications
Status
• Still BETA (v0.9.7)
• Stabilizing. More performance
improvements are secondary importance.
• Bug reports are welcome
• Tested with SBCL, CCL, ABCL and ECL

on Travis CI
Status
Try the new player
and send me a feedback.
Thanks.
EITARO FUKAMACHI
8arrow.org
@nitro_idiot fukamachi
See Also
• Dexador: github.com/fukamachi/dexador

More Related Content

What's hot

Attacking thru HTTP Host header
Attacking thru HTTP Host headerAttacking thru HTTP Host header
Attacking thru HTTP Host headerSergey Belov
 
Entity provider selection confusion attacks in JAX-RS applications
Entity provider selection confusion attacks in JAX-RS applicationsEntity provider selection confusion attacks in JAX-RS applications
Entity provider selection confusion attacks in JAX-RS applicationsMikhail Egorov
 
Understanding REST
Understanding RESTUnderstanding REST
Understanding RESTNitin Pande
 
Introduction to HTTP/2
Introduction to HTTP/2Introduction to HTTP/2
Introduction to HTTP/2Ido Flatow
 
HTTP Request Header and HTTP Status Code
HTTP Request Header and HTTP Status CodeHTTP Request Header and HTTP Status Code
HTTP Request Header and HTTP Status CodeAbhishek L.R
 
Introducing envoy-based service mesh at Booking.com
Introducing envoy-based service mesh at Booking.comIntroducing envoy-based service mesh at Booking.com
Introducing envoy-based service mesh at Booking.comIvan Kruglov
 
Angular and The Case for RxJS
Angular and The Case for RxJSAngular and The Case for RxJS
Angular and The Case for RxJSSandi Barr
 
Awesome Traefik - Ingress Controller for Kubernetes - Swapnasagar Pradhan
Awesome Traefik - Ingress Controller for Kubernetes - Swapnasagar PradhanAwesome Traefik - Ingress Controller for Kubernetes - Swapnasagar Pradhan
Awesome Traefik - Ingress Controller for Kubernetes - Swapnasagar PradhanAjeet Singh Raina
 
REST API and CRUD
REST API and CRUDREST API and CRUD
REST API and CRUDPrem Sanil
 
HTTP/2 Changes Everything
HTTP/2 Changes EverythingHTTP/2 Changes Everything
HTTP/2 Changes EverythingLori MacVittie
 
Cross Origin Resource Sharing
Cross Origin Resource SharingCross Origin Resource Sharing
Cross Origin Resource SharingLuke Weerasooriya
 
Introduction to gRPC: A general RPC framework that puts mobile and HTTP/2 fir...
Introduction to gRPC: A general RPC framework that puts mobile and HTTP/2 fir...Introduction to gRPC: A general RPC framework that puts mobile and HTTP/2 fir...
Introduction to gRPC: A general RPC framework that puts mobile and HTTP/2 fir...Codemotion
 
Rust: Systems Programming for Everyone
Rust: Systems Programming for EveryoneRust: Systems Programming for Everyone
Rust: Systems Programming for EveryoneC4Media
 

What's hot (20)

REST API
REST APIREST API
REST API
 
Http caching basics
Http caching basicsHttp caching basics
Http caching basics
 
Building Advanced XSS Vectors
Building Advanced XSS VectorsBuilding Advanced XSS Vectors
Building Advanced XSS Vectors
 
Attacking thru HTTP Host header
Attacking thru HTTP Host headerAttacking thru HTTP Host header
Attacking thru HTTP Host header
 
Entity provider selection confusion attacks in JAX-RS applications
Entity provider selection confusion attacks in JAX-RS applicationsEntity provider selection confusion attacks in JAX-RS applications
Entity provider selection confusion attacks in JAX-RS applications
 
Understanding REST
Understanding RESTUnderstanding REST
Understanding REST
 
Introduction to HTTP/2
Introduction to HTTP/2Introduction to HTTP/2
Introduction to HTTP/2
 
HTTP Request Header and HTTP Status Code
HTTP Request Header and HTTP Status CodeHTTP Request Header and HTTP Status Code
HTTP Request Header and HTTP Status Code
 
Introducing envoy-based service mesh at Booking.com
Introducing envoy-based service mesh at Booking.comIntroducing envoy-based service mesh at Booking.com
Introducing envoy-based service mesh at Booking.com
 
Intro to WebSockets
Intro to WebSocketsIntro to WebSockets
Intro to WebSockets
 
Angular and The Case for RxJS
Angular and The Case for RxJSAngular and The Case for RxJS
Angular and The Case for RxJS
 
Oauth2.0
Oauth2.0Oauth2.0
Oauth2.0
 
Awesome Traefik - Ingress Controller for Kubernetes - Swapnasagar Pradhan
Awesome Traefik - Ingress Controller for Kubernetes - Swapnasagar PradhanAwesome Traefik - Ingress Controller for Kubernetes - Swapnasagar Pradhan
Awesome Traefik - Ingress Controller for Kubernetes - Swapnasagar Pradhan
 
Http protocol
Http protocolHttp protocol
Http protocol
 
REST API and CRUD
REST API and CRUDREST API and CRUD
REST API and CRUD
 
CORS and (in)security
CORS and (in)securityCORS and (in)security
CORS and (in)security
 
HTTP/2 Changes Everything
HTTP/2 Changes EverythingHTTP/2 Changes Everything
HTTP/2 Changes Everything
 
Cross Origin Resource Sharing
Cross Origin Resource SharingCross Origin Resource Sharing
Cross Origin Resource Sharing
 
Introduction to gRPC: A general RPC framework that puts mobile and HTTP/2 fir...
Introduction to gRPC: A general RPC framework that puts mobile and HTTP/2 fir...Introduction to gRPC: A general RPC framework that puts mobile and HTTP/2 fir...
Introduction to gRPC: A general RPC framework that puts mobile and HTTP/2 fir...
 
Rust: Systems Programming for Everyone
Rust: Systems Programming for EveryoneRust: Systems Programming for Everyone
Rust: Systems Programming for Everyone
 

Similar to Dexador Rises

Http capturing
Http capturingHttp capturing
Http capturingEric Ahn
 
Web前端性能优化 2014
Web前端性能优化 2014Web前端性能优化 2014
Web前端性能优化 2014Yubei Li
 
Atlassian meets Kerberos
Atlassian meets KerberosAtlassian meets Kerberos
Atlassian meets KerberosNils Hofmeister
 
Inside Of Mbga Open Platform
Inside Of Mbga Open PlatformInside Of Mbga Open Platform
Inside Of Mbga Open PlatformHideo Kimura
 
HTTP Caching and PHP
HTTP Caching and PHPHTTP Caching and PHP
HTTP Caching and PHPDavid de Boer
 
Apache CouchDB talk at Ontario GNU Linux Fest
Apache CouchDB talk at Ontario GNU Linux FestApache CouchDB talk at Ontario GNU Linux Fest
Apache CouchDB talk at Ontario GNU Linux FestMyles Braithwaite
 
SPDY & HTTP2.0 & QUIC - #bpstudy 2013-08-28
SPDY & HTTP2.0 & QUIC - #bpstudy 2013-08-28SPDY & HTTP2.0 & QUIC - #bpstudy 2013-08-28
SPDY & HTTP2.0 & QUIC - #bpstudy 2013-08-28Jxck Jxck
 
Varnish Cache and Django (Falcon, Flask etc)
Varnish Cache and Django (Falcon, Flask etc)Varnish Cache and Django (Falcon, Flask etc)
Varnish Cache and Django (Falcon, Flask etc)Данил Иванов
 
VUG5: Varnish at Opera Software
VUG5: Varnish at Opera SoftwareVUG5: Varnish at Opera Software
VUG5: Varnish at Opera SoftwareCosimo Streppone
 
Logstash for SEO: come monitorare i Log del Web Server in realtime
Logstash for SEO: come monitorare i Log del Web Server in realtimeLogstash for SEO: come monitorare i Log del Web Server in realtime
Logstash for SEO: come monitorare i Log del Web Server in realtimeAndrea Cardinale
 
Devoxx Maroc 2015 HTTP 1, HTTP 2 and folks
Devoxx Maroc  2015 HTTP 1, HTTP 2 and folksDevoxx Maroc  2015 HTTP 1, HTTP 2 and folks
Devoxx Maroc 2015 HTTP 1, HTTP 2 and folksNicolas Martignole
 
Naked Performance With Clojure
Naked Performance With ClojureNaked Performance With Clojure
Naked Performance With ClojureMetosin Oy
 
An Introduction to Twisted
An Introduction to TwistedAn Introduction to Twisted
An Introduction to Twistedsdsern
 

Similar to Dexador Rises (20)

tdc2012
tdc2012tdc2012
tdc2012
 
Http capturing
Http capturingHttp capturing
Http capturing
 
Haproxy - zastosowania
Haproxy - zastosowaniaHaproxy - zastosowania
Haproxy - zastosowania
 
Web前端性能优化 2014
Web前端性能优化 2014Web前端性能优化 2014
Web前端性能优化 2014
 
Http2 in practice
Http2 in practiceHttp2 in practice
Http2 in practice
 
6 app-tcp
6 app-tcp6 app-tcp
6 app-tcp
 
Atlassian meets Kerberos
Atlassian meets KerberosAtlassian meets Kerberos
Atlassian meets Kerberos
 
Inside Of Mbga Open Platform
Inside Of Mbga Open PlatformInside Of Mbga Open Platform
Inside Of Mbga Open Platform
 
HTTP Caching and PHP
HTTP Caching and PHPHTTP Caching and PHP
HTTP Caching and PHP
 
Apache CouchDB talk at Ontario GNU Linux Fest
Apache CouchDB talk at Ontario GNU Linux FestApache CouchDB talk at Ontario GNU Linux Fest
Apache CouchDB talk at Ontario GNU Linux Fest
 
Apache mod authまわりとか
Apache mod authまわりとかApache mod authまわりとか
Apache mod authまわりとか
 
SPDY & HTTP2.0 & QUIC - #bpstudy 2013-08-28
SPDY & HTTP2.0 & QUIC - #bpstudy 2013-08-28SPDY & HTTP2.0 & QUIC - #bpstudy 2013-08-28
SPDY & HTTP2.0 & QUIC - #bpstudy 2013-08-28
 
Into The Box 2018 Ortus Keynote
Into The Box 2018 Ortus KeynoteInto The Box 2018 Ortus Keynote
Into The Box 2018 Ortus Keynote
 
Varnish Cache and Django (Falcon, Flask etc)
Varnish Cache and Django (Falcon, Flask etc)Varnish Cache and Django (Falcon, Flask etc)
Varnish Cache and Django (Falcon, Flask etc)
 
VUG5: Varnish at Opera Software
VUG5: Varnish at Opera SoftwareVUG5: Varnish at Opera Software
VUG5: Varnish at Opera Software
 
Logstash for SEO: come monitorare i Log del Web Server in realtime
Logstash for SEO: come monitorare i Log del Web Server in realtimeLogstash for SEO: come monitorare i Log del Web Server in realtime
Logstash for SEO: come monitorare i Log del Web Server in realtime
 
Load testing with Blitz
Load testing with BlitzLoad testing with Blitz
Load testing with Blitz
 
Devoxx Maroc 2015 HTTP 1, HTTP 2 and folks
Devoxx Maroc  2015 HTTP 1, HTTP 2 and folksDevoxx Maroc  2015 HTTP 1, HTTP 2 and folks
Devoxx Maroc 2015 HTTP 1, HTTP 2 and folks
 
Naked Performance With Clojure
Naked Performance With ClojureNaked Performance With Clojure
Naked Performance With Clojure
 
An Introduction to Twisted
An Introduction to TwistedAn Introduction to Twisted
An Introduction to Twisted
 

More from fukamachi

競プロの話
競プロの話競プロの話
競プロの話fukamachi
 
Rove / Testing is a pity in Common Lisp
Rove / Testing is a pity in Common LispRove / Testing is a pity in Common Lisp
Rove / Testing is a pity in Common Lispfukamachi
 
Building GUI App with Electron and Lisp
Building GUI App with Electron and LispBuilding GUI App with Electron and Lisp
Building GUI App with Electron and Lispfukamachi
 
Mito, a successor of Integral
Mito, a successor of IntegralMito, a successor of Integral
Mito, a successor of Integralfukamachi
 
Clack: glue for web apps
Clack: glue for web appsClack: glue for web apps
Clack: glue for web appsfukamachi
 
Woo: Writing a fast web server
Woo: Writing a fast web serverWoo: Writing a fast web server
Woo: Writing a fast web serverfukamachi
 
Redesigning Common Lisp
Redesigning Common LispRedesigning Common Lisp
Redesigning Common Lispfukamachi
 
Integral - New O/R Mapper for Common Lisp
Integral - New O/R Mapper for Common LispIntegral - New O/R Mapper for Common Lisp
Integral - New O/R Mapper for Common Lispfukamachi
 
第四回関西Emacs「ari.el」
第四回関西Emacs「ari.el」第四回関西Emacs「ari.el」
第四回関西Emacs「ari.el」fukamachi
 
Clack & Caveman
Clack & CavemanClack & Caveman
Clack & Cavemanfukamachi
 
Lispで仕事をするために
Lispで仕事をするためにLispで仕事をするために
Lispで仕事をするためにfukamachi
 
Lisperの見る世界
Lisperの見る世界Lisperの見る世界
Lisperの見る世界fukamachi
 
JavaからClojure、そして夢の世界へ
JavaからClojure、そして夢の世界へJavaからClojure、そして夢の世界へ
JavaからClojure、そして夢の世界へfukamachi
 
自分をClojure化する方法
自分をClojure化する方法自分をClojure化する方法
自分をClojure化する方法fukamachi
 
Google App Engine for Java (手嶋屋勉強会)
Google App Engine for Java (手嶋屋勉強会)Google App Engine for Java (手嶋屋勉強会)
Google App Engine for Java (手嶋屋勉強会)fukamachi
 

More from fukamachi (18)

競プロの話
競プロの話競プロの話
競プロの話
 
Rove / Testing is a pity in Common Lisp
Rove / Testing is a pity in Common LispRove / Testing is a pity in Common Lisp
Rove / Testing is a pity in Common Lisp
 
Building GUI App with Electron and Lisp
Building GUI App with Electron and LispBuilding GUI App with Electron and Lisp
Building GUI App with Electron and Lisp
 
SBLint
SBLintSBLint
SBLint
 
Mito, a successor of Integral
Mito, a successor of IntegralMito, a successor of Integral
Mito, a successor of Integral
 
Clack: glue for web apps
Clack: glue for web appsClack: glue for web apps
Clack: glue for web apps
 
Woo: Writing a fast web server
Woo: Writing a fast web serverWoo: Writing a fast web server
Woo: Writing a fast web server
 
Redesigning Common Lisp
Redesigning Common LispRedesigning Common Lisp
Redesigning Common Lisp
 
Integral - New O/R Mapper for Common Lisp
Integral - New O/R Mapper for Common LispIntegral - New O/R Mapper for Common Lisp
Integral - New O/R Mapper for Common Lisp
 
Shelly
ShellyShelly
Shelly
 
第四回関西Emacs「ari.el」
第四回関西Emacs「ari.el」第四回関西Emacs「ari.el」
第四回関西Emacs「ari.el」
 
Clack & Caveman
Clack & CavemanClack & Caveman
Clack & Caveman
 
Lispで仕事をするために
Lispで仕事をするためにLispで仕事をするために
Lispで仕事をするために
 
Lisperの見る世界
Lisperの見る世界Lisperの見る世界
Lisperの見る世界
 
Lisp Poetry
Lisp PoetryLisp Poetry
Lisp Poetry
 
JavaからClojure、そして夢の世界へ
JavaからClojure、そして夢の世界へJavaからClojure、そして夢の世界へ
JavaからClojure、そして夢の世界へ
 
自分をClojure化する方法
自分をClojure化する方法自分をClojure化する方法
自分をClojure化する方法
 
Google App Engine for Java (手嶋屋勉強会)
Google App Engine for Java (手嶋屋勉強会)Google App Engine for Java (手嶋屋勉強会)
Google App Engine for Java (手嶋屋勉強会)
 

Recently uploaded

Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...apidays
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxRustici Software
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...apidays
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobeapidays
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusZilliz
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingEdi Saputra
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamUiPathCommunity
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Victor Rentea
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Orbitshub
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesrafiqahmad00786416
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businesspanagenda
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...apidays
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native ApplicationsWSO2
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfOrbitshub
 

Recently uploaded (20)

Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 

Dexador Rises

  • 1. Dexador Rises Lisp Meet Up #31 August 26, 2015 Eitaro Fukamachi Somewrite Co., Ltd.
  • 3. My Products • Clack • Caveman2 • Woo • quickdocs.org • Qlot
  • 5.
  • 8. Today, let me talk about HTTP client.
  • 10. HTTP client Client Server HTTP Request GET / HTTP/1.1 Host: quickdocs.org User-Agent: curl/7.43.0 Accept: */*
  • 11. HTTP client Client Server HTTP Request HTTP Response GET / HTTP/1.1 Host: quickdocs.org User-Agent: curl/7.43.0 Accept: */* HTTP/1.1 200 OK Date: Mon, 24 Aug 2015 00:41:36 GMT Content-Type: text/html Content-Length: 3771 Connection: keep-alive
  • 12. HTTP client Client Server HTTP Request HTTP Response GET / HTTP/1.1 Host: quickdocs.org User-Agent: curl/7.43.0 Accept: */* HTTP/1.1 200 OK Date: Mon, 24 Aug 2015 00:41:36 GMT Content-Type: text/html Content-Length: 3771 Connection: keep-alive ex) Google Chrome, curl, Drakma ex) Apache, nginx, Woo
  • 13. HTTP client libraries • Drakma • trivial-http • Carrier
  • 14. HTTP client libraries • Drakma • De facto. Full-featured. • trivial-http • Simple. A few features. No SSL. • Carrier • Asynchronous.
  • 15. HTTP client libraries • Drakma (usocket) • De facto. Full-featured. • trivial-http (usocket) • Simple. A few features. No SSL. • Carrier (cl-async/libuv) • Asynchronous.
  • 16. HTTP client libraries • Drakma (usocket) • De facto. Full-featured. • trivial-http (usocket) • Simple. A few features. No SSL. • Carrier (cl-async/libuv) • Asynchronous. 75 LIBRARIES Required by 3 LIBRARIES None
  • 17. Drakma • Ediware • Since 2006 • Still maintained at GitHub Mature??? Easy to use??? Fast???
  • 18. No.
  • 20. • Force URL encoding with PURI Pitfall (1/3) of Drakma (drakma:http-request (format nil “http://b.hatena.ne.jp/search/tag?q=~A” tag)) tag = “lisp” => OK tag = “scheme” => OK tag = “clojure” => OK tag = “common lisp” => PURI:URI-PARSE-ERROR
  • 21. • Force URL encoding with PURI Pitfall (1/3) of Drakma (drakma:http-request (format nil “http://b.hatena.ne.jp/search/tag?q=~A” (drakma:url-encode tag :utf-8))) tag = “lisp” => OK tag = “scheme” => OK tag = “clojure” => OK tag = “common lisp” => “common+lisp”
  • 22. • Force URL encoding with PURI Pitfall (1/3) of Drakma (drakma:http-request (format nil “http://b.hatena.ne.jp/search/tag?q=~A” (drakma:url-encode tag :utf-8))) tag = “lisp” => OK tag = “scheme” => OK tag = “clojure” => OK tag = “common lisp” => “common+lisp” tag = “AKB48” => OK tag = “乃木坂46” => "%E4%B9%83%E6%9C%A8%E5%9D%8246"
  • 23. • Force URL encoding with PURI Pitfall (1/3) of Drakma (drakma:http-request (format nil “http://b.hatena.ne.jp/search/tag?q=~A” (drakma:url-encode tag :utf-8)) :preserve-uri t) tag = “lisp” => OK tag = “scheme” => OK tag = “clojure” => OK tag = “common lisp” => OK tag = “AKB48” => OK tag = “乃木坂46” => OK
  • 25. • Poor language support with flexi-streams Pitfall (2/3) of Drakma (drakma:http-request “http://www.hatena.ne.jp/”) (drakma:http-request “http://www.google.co.jp/”)
  • 26. • Poor language support with flexi-streams Pitfall (2/3) of Drakma (drakma:http-request “http://www.hatena.ne.jp/”) ;; => body as UTF-8 string (drakma:http-request “http://www.google.co.jp/”) ;; => body as byte vector WARNING: Problems determining charset (falling back to binary): :SHIFT_JIS is not known to be a name for an external format.
  • 28. • Tend to forget error handling Pitfall (3/3) of Drakma (let* ((body (drakma:http-request “http://cliki.net”)) (parsed-html (plump:parse body))) …)
  • 29. • Tend to forget error handling Pitfall (3/3) of Drakma (let* ((body (drakma:http-request “http://cliki.net”)) (parsed-html (plump:parse body))) …) It fails if the HTTP response code is 4xx or 5xx.
  • 30. • Tend to forget error handling Pitfall (3/3) of Drakma (multiple-value-bind (body status) (drakma:http-request “http://cliki.net”) (unless (= status 200) (error “An HTTP request failed (Code=~D)” status)) (let ((parsed-html (plump:parse body))) …)) Raise an error unless the status is not 200
  • 31. • Tend to forget error handling Pitfall (3/3) of Drakma (multiple-value-bind (body status) (drakma:http-request “http://cliki.net”) (unless (= status 200) (error “An HTTP request failed (Code=~D)” status)) (let ((parsed-html (plump:parse body))) …)) Raise an error unless the status is not 200 Want to retry???
  • 32. • Tend to forget error handling Pitfall (3/3) of Drakma (block nil (tagbody retry (multiple-value-bind (body status) (drakma:http-request "http://cliki.net/") (unless (= status 200) (go retry)) (return body)))) With Auto-Retrying
  • 33. • Tend to forget error handling Pitfall (3/3) of Drakma (block nil (let ((times 5)) (tagbody retry (multiple-value-bind (body status) (drakma:http-request "http://cliki.net/") (unless (= status 200) (when (= times 0) (error "An HTTP request failed. (Code=~D)” status)) (decf times) (go retry)) (return body))))) Retry only 5 times
  • 36. We just wanted to send an HTTP request.
  • 38. • Full-featured. usocket based. • Use fast-http, QURI, Babel, cl-cookie Dexador: Another choice
  • 39. Dexador: APIs (dex:get “http://lisp.org/“) (dex:post “http://lisp.org/“) (dex:head “http://lisp.org/“) (dex:put “http://lisp.org/“) (dex:delete “http://lisp.org/“)
  • 40. Dexador: Language support ;; Shift_JIS (dex:get “http://www.google.co.jp/“) ;; EUC-JP (dex:get “https://mixi.jp/“)
  • 41. Dexador: Error handling (handler-case (dex:get “http://cliki.net/“) (dex:http-request-failed (e) (warn “An HTTP request failed (Code=~D)” (dex:response-status e))))
  • 42. Dexador: Error handling (handler-case (dex:get “http://cliki.net/“) (dex:http-request-forbidden () ;; for 403 forbidden ) (dex:http-request-service-unavailable () ;; for 503 service unavailable ) (dex:http-request-failed (e) (warn “An HTTP request failed (Code=~D)” (dex:response-status e))))
  • 43. Dexador: Error handling ;; Ignore errors and continue (handler-bind ((dex:http-request-failed #'dex:ignore-and-continue)) (dex:get "http://lisp.org"))
  • 44. Dexador: Auto-Retrying ;; Auto-retry on 503 error (handler-bind ((dex:http-request-service-unavailable #’dex:retry-request)) (dex:get "http://lisp.org"))
  • 45. Dexador: Auto-Retrying ;; Retry only 5 times (handler-bind ((dex:http-request-service-unavailable (dex:retry-request 5))) (dex:get "http://lisp.org"))
  • 46. Dexador: Auto-Retrying ;; Retry only 5 times at 3-second intervals (handler-bind ((dex:http-request-service-unavailable (dex:retry-request 5 :interval 3))) (dex:get "http://lisp.org"))
  • 47. Dexador: Auto-Retrying ;; Retry only 5 times at 3-second intervals (handler-bind ((dex:http-request-service-unavailable (dex:retry-request 5 :interval 3))) (dex:get "http://lisp.org")) (block nil (let ((times 5)) (tagbody retry (multiple-value-bind (body status) (drakma:http-request "http://cliki.net/") (unless (= status 200) (when (= times 0) (error "An HTTP request failed. (Code=~D)” status)) (decf times) (sleep 3) (go retry)) (return body))))) Dexador Drakma
  • 50. Benchmark Sending GET request 30 times to Local Server
 (lower is better) 0 0.009 0.018 0.026 0.035 Drakma Dexador
 w/out conneciton-pool 0.024s
  • 51. Benchmark Sending GET request 30 times to Local Server
 (lower is better) 0 0.009 0.018 0.026 0.035 Drakma Dexador
 w/out conneciton-pool 0.013s 0.024s
  • 52. Sending GET request 30 times to Local Server
 (lower is better) 0 0.009 0.018 0.026 0.035 Drakma Dexador
 w/out conneciton-pool 0.013s 0.024s Benchmark x1.8 faster!
  • 53. Sending GET request 30 times to Local Server
 (lower is better) 0 0.009 0.018 0.026 0.035 Drakma Dexador
 w/out conneciton-pool 0.013s 0.024s Benchmark x1.8 faster!????
  • 55. Benchmark Sending GET request 30 times to Remote Server
 (lower is better) 0 0.15 0.3 0.45 0.6 Drakma Dexador
 w/out conneciton-pool 0.505s
  • 56. Benchmark Sending GET request 30 times to Remote Server
 (lower is better) 0 0.15 0.3 0.45 0.6 Drakma Dexador
 w/out conneciton-pool 0.396s 0.505s
  • 57. Benchmark Sending GET request 30 times to Remote Server
 (lower is better) 0 0.15 0.3 0.45 0.6 Drakma Dexador
 w/out conneciton-pool 0.396s 0.505s x1.2 faster
  • 58. Benchmark Sending GET request 30 times to Remote Server
 (lower is better) 0 0.15 0.3 0.45 0.6 Drakma Dexador
 w/out conneciton-pool 0.396s 0.505s 0.0036 sec/req
  • 59. Benchmark Sending GET request 30 times to Remote Server
 (lower is better) 0 0.15 0.3 0.45 0.6 Drakma Dexador
 w/out conneciton-pool 0.396s 0.505s 0.0036 sec/req Too trivial improvement…
  • 61. Benchmark Sending GET request 30 times to Remote Server
 (lower is better) 0 0.15 0.3 0.45 0.6 Drakma Dexador
 w/out conneciton-pool 0.396s 0.505s
  • 62. Benchmark Sending GET request 30 times to Remote Server
 (lower is better) 0 0.15 0.3 0.45 0.6 Drakma Dexador
 w/out conneciton-pool 0.396s 0.505s Network Latency + Connection establishment Network Latency + Connection establishment
  • 63. Benchmark Sending GET request 30 times to Remote Server
 (lower is better) 0 0.15 0.3 0.45 0.6 Drakma Dexador
 w/out conneciton-pool 0.396s 0.505s Network Latency + Connection establishment Network Latency + Connection establishment The largest bottleneck
  • 64. Differences of Servers/Clients HTTP Server HTTP Client C S C C C S
  • 67. • Reuse connections once established (Implicit) Connection-pooling
  • 68. • Reuse connections once established (Implicit) Connection-pooling ;; Establish a new connection (dex:get “http://lisp.org/index.html“) ;; Reuse the above connection (dex:get “http://lisp.org/index.html“)
  • 69. • Reuse connections once established (Implicit) Connection-pooling ;; Establish a new connection (dex:get “http://lisp.org/index.html“) ;; Reuse the above connection (dex:get “http://lisp.org/index.html“) 0.727 sec 0.380 sec
  • 71. Benchmark Sending GET request 30 times to Local Server
 (lower is better) 0 0.006 0.012 0.018 0.024 Drakma Dexador
 w/out conneciton-pool Dexador
 w/ connection-pool 0.013s 0.024s
  • 72. Benchmark Sending GET request 30 times to Local Server
 (lower is better) 0 0.006 0.012 0.018 0.024 Drakma Dexador
 w/out conneciton-pool Dexador
 w/ connection-pool 0.005s 0.013s 0.024s
  • 73. Benchmark Sending GET request 30 times to Local Server
 (lower is better) 0 0.006 0.012 0.018 0.024 Drakma Dexador
 w/out conneciton-pool Dexador
 w/ connection-pool 0.005s 0.013s 0.024s x4.8 faster!
  • 74. Benchmark Sending GET request 30 times to Remote Server
 (lower is better) 0 0.15 0.3 0.45 0.6 Drakma Dexador
 w/out conneciton-pool Dexador
 w/ connection-pool 0.396s 0.505s
  • 75. Benchmark Sending GET request 30 times to Remote Server
 (lower is better) 0 0.15 0.3 0.45 0.6 Drakma Dexador
 w/out conneciton-pool Dexador
 w/ connection-pool 0.219s 0.396s 0.505s
  • 76. Benchmark Sending GET request 30 times to Remote Server
 (lower is better) 0 0.15 0.3 0.45 0.6 Drakma Dexador
 w/out conneciton-pool Dexador
 w/ connection-pool 0.219s 0.396s 0.505s Still x2.3 faster!
  • 77. • It’s pretty common to request to the same host multiple times • Can expect some performance improvements in real applications In real applications
  • 79. • Still BETA (v0.9.7) • Stabilizing. More performance improvements are secondary importance. • Bug reports are welcome • Tested with SBCL, CCL, ABCL and ECL
 on Travis CI Status
  • 80. Try the new player and send me a feedback.
  • 83. See Also • Dexador: github.com/fukamachi/dexador