SlideShare a Scribd company logo
1 of 21
Download to read offline
Android HTTP Cache
                  (     )
                            2010-09-18




2010-10-03
Android HTTP
             •   java.net

                 •   Java

                 •          HTTP             HttpURLConnection

             •   org.apache.http

                 •   Apache HttpClient 4.0   Android

                 •   HTTP

             •   android.webkit

                 •   Android       Android UI     Web

                 •   HTTP                              Web




2010-10-03
(HTTP       )




             •   Android HTTP
                 (3G      300kbps 2000kbps)

             •                  →             →


             →




2010-10-03
(   )



             •
                 •
                 •               (           )

                 •
             •
             →HTTP/1.1 Caching




2010-10-03
HTTP/1.1 Caching




             •   RFC2616

             •         Web          Web

             •   HTTP/1.1 Caching   HTTP




2010-10-03
HTTP/1.1 Caching

             •                  HTTP

                 •   If-Modified-Since

                     •


                 •   If-None-Match

                     •




2010-10-03
HTTP/1.1 Caching

             •                   HTTP

                 •   Expires

                     •
                 •   Last-Modified

                     •                        If-Modified-Since

                 •   ETag

                     •                                           If-None-
                         Match




2010-10-03
HTTP/1.1 Caching


             •                         HTTP

                 •   Cache-Control

                     •
                 •   Pragma

                     •                  Proxy


                          : no-cache




2010-10-03
HTTP/1.1 Caching




             •   Apache   lighthttpd   Web

             •
             •                               (




2010-10-03
HTTP/1.1 Caching




             •   android.webkit   HTTP/1.1 Caching

             •
             •
             →Apache HttpClient-Cache




2010-10-03
Apache HttpClient-Cache




             •   Apache HttpClient 4.1

             •   HTTP/1.1 Caching

             •         alpha (2010       9   )




2010-10-03
Apache HttpClient-Cache


             •       URL


                 •   http://hc.apache.org/

             •   Subversion URL

                 •   http://svn.apache.org/repos/asf/httpcomponents/httpclient/trunk/httpclient-cache

                 •   jar                              http://svn.apache.org/repos/asf/httpcomponents/httpclient/trunk/
                             svn get         mvn package


                 •   Revision: 990924                                  (2010-09-05      )   990925          Serialize
                           NotSerializableException


             •   Maven URL

                 •   http://repo1.maven.org/maven2/org/apache/httpcomponents/httpclient-cache/




2010-10-03
Apache HttpClient-Cache



             •   Caching                               : org.apache.http.client.HttpClient
                            : CachingHttpClient

             •                              DefaultHttpClient     CachingHttpClient



             •   Android       Apache HttpClient 4.0                 (
                   )

             •   alpha                                 (                              )




2010-10-03
Apache HttpClient-Cache


             •   Cache             HTTP

                 •   HTTP 1.1

                 •   Method: GET

                 •   No Header: "Pragma"

                 •   No Header: "Cache-Control: no-store"

                 •   No Header: "Cache-Control: no-cache"


             •   ※
                 org.apache.http.impl.client.cache.CacheableRequestPolicy




2010-10-03
Android




             •   Eclipse

             •   Android

             •   Java Build Path Apache HttpClient 4.1   jar




2010-10-03
Android



             •   Apache HttpClient-Cache      HTTP

             •   Cache Data Read/Write

             •
                 •   Cache Data Serialize

                 •
             •   ※org.apache.http.client.cache.HttpCacheStorage




2010-10-03
CachingHttpClient     DefaultHttpClient



                      Expires:
                    Last-Modified:
                                                           281(ms)              122(ms)
                        Etag:
                     File Size: 295 KB
                      Expires:
                    Last-Modified:
                                                            50(ms)              125(ms)
                        Etag:
                      File Size: 4KB
                      Expires:
                    Last-Modified:
                                                           200 (ms)             128 (ms)
                        Etag:
                      File Size: 8KB

             ※HTTP GET              HTTP Response
             ※5
             ※Nexus One (Android 2.2)           Wi-FI
             ※           : http://www1.axfc.net/uploader/Sc/so/154474.zip

2010-10-03
Caching




             →CachingHttpClient#execute()




2010-10-03
•   Apache HttpClient-Cache



             •                                        Caching
                            Caching
                 →   HTTP Response

             •   2010   9

             •                                     HTTP Response
                     Caching      android.webkit




2010-10-03
URL



             •   HTTP/1.1: Caching in HTTP

                 •   http://www.w3.org/Protocols/rfc2616/rfc2616-sec13.html

             •               Web

                 •   http://www.atmarkit.co.jp/fjava/rensai2/webopt12/webopt12.html

             •   Android

                 •   http://www.ibm.com/developerworks/jp/opensource/library/os-android-
                     networking/




2010-10-03
•   Web

                 •   http://www.amazon.co.jp/dp/4774142042




2010-10-03

More Related Content

What's hot

Scalable Architecture 101
Scalable Architecture 101Scalable Architecture 101
Scalable Architecture 101ConFoo
 
Apache Performance Tuning: Scaling Up
Apache Performance Tuning: Scaling UpApache Performance Tuning: Scaling Up
Apache Performance Tuning: Scaling UpSander Temme
 
How To Set Up SQL Load Balancing with HAProxy - Slides
How To Set Up SQL Load Balancing with HAProxy - SlidesHow To Set Up SQL Load Balancing with HAProxy - Slides
How To Set Up SQL Load Balancing with HAProxy - SlidesSeveralnines
 
Building your own CDN using Amazon EC2
Building your own CDN using Amazon EC2Building your own CDN using Amazon EC2
Building your own CDN using Amazon EC2SergeyChernyshev
 
Integrating multiple CDN providers at Etsy - Velocity Europe (London) 2013
Integrating multiple CDN providers at Etsy - Velocity Europe (London) 2013Integrating multiple CDN providers at Etsy - Velocity Europe (London) 2013
Integrating multiple CDN providers at Etsy - Velocity Europe (London) 2013Marcus Barczak
 
Caching with Varnish
Caching with VarnishCaching with Varnish
Caching with Varnishschoefmax
 
Pushing the web — WebSockets
Pushing the web — WebSocketsPushing the web — WebSockets
Pushing the web — WebSocketsRoland M
 
HTTP 2.0 – What do I need to know?
HTTP 2.0 – What do I need to know? HTTP 2.0 – What do I need to know?
HTTP 2.0 – What do I need to know? Sigma Software
 
Frontera распределенный робот для обхода веба в больших объемах / Александр С...
Frontera распределенный робот для обхода веба в больших объемах / Александр С...Frontera распределенный робот для обхода веба в больших объемах / Александр С...
Frontera распределенный робот для обхода веба в больших объемах / Александр С...Ontico
 
Web performance across the HTTP to HTTPS transition
Web performance across the HTTP to HTTPS transitionWeb performance across the HTTP to HTTPS transition
Web performance across the HTTP to HTTPS transitionseanwalbran
 
Advanced Web Hosting
Advanced Web HostingAdvanced Web Hosting
Advanced Web HostingOVHcloud
 
Varnish Cache Plus. Random notes for wise web developers
Varnish Cache Plus. Random notes for wise web developersVarnish Cache Plus. Random notes for wise web developers
Varnish Cache Plus. Random notes for wise web developersCarlos Abalde
 

What's hot (20)

Varnish SSL / TLS
Varnish SSL / TLSVarnish SSL / TLS
Varnish SSL / TLS
 
Scalable Architecture 101
Scalable Architecture 101Scalable Architecture 101
Scalable Architecture 101
 
Apache Performance Tuning: Scaling Up
Apache Performance Tuning: Scaling UpApache Performance Tuning: Scaling Up
Apache Performance Tuning: Scaling Up
 
How To Set Up SQL Load Balancing with HAProxy - Slides
How To Set Up SQL Load Balancing with HAProxy - SlidesHow To Set Up SQL Load Balancing with HAProxy - Slides
How To Set Up SQL Load Balancing with HAProxy - Slides
 
Building your own CDN using Amazon EC2
Building your own CDN using Amazon EC2Building your own CDN using Amazon EC2
Building your own CDN using Amazon EC2
 
Integrating multiple CDN providers at Etsy - Velocity Europe (London) 2013
Integrating multiple CDN providers at Etsy - Velocity Europe (London) 2013Integrating multiple CDN providers at Etsy - Velocity Europe (London) 2013
Integrating multiple CDN providers at Etsy - Velocity Europe (London) 2013
 
Caching with Varnish
Caching with VarnishCaching with Varnish
Caching with Varnish
 
Pushing the web — WebSockets
Pushing the web — WebSocketsPushing the web — WebSockets
Pushing the web — WebSockets
 
Varnish intro
Varnish introVarnish intro
Varnish intro
 
ReplacingSquidWithATS
ReplacingSquidWithATSReplacingSquidWithATS
ReplacingSquidWithATS
 
HTTP 2.0 – What do I need to know?
HTTP 2.0 – What do I need to know? HTTP 2.0 – What do I need to know?
HTTP 2.0 – What do I need to know?
 
WebSocket protocol
WebSocket protocolWebSocket protocol
WebSocket protocol
 
Frontera распределенный робот для обхода веба в больших объемах / Александр С...
Frontera распределенный робот для обхода веба в больших объемах / Александр С...Frontera распределенный робот для обхода веба в больших объемах / Александр С...
Frontera распределенный робот для обхода веба в больших объемах / Александр С...
 
Tomcat openssl
Tomcat opensslTomcat openssl
Tomcat openssl
 
Web performance across the HTTP to HTTPS transition
Web performance across the HTTP to HTTPS transitionWeb performance across the HTTP to HTTPS transition
Web performance across the HTTP to HTTPS transition
 
Advanced Web Hosting
Advanced Web HostingAdvanced Web Hosting
Advanced Web Hosting
 
HTTP/2 (2017)
HTTP/2 (2017)HTTP/2 (2017)
HTTP/2 (2017)
 
Tomcat openssl
Tomcat opensslTomcat openssl
Tomcat openssl
 
Shiny New HTTP Shit
Shiny New HTTP ShitShiny New HTTP Shit
Shiny New HTTP Shit
 
Varnish Cache Plus. Random notes for wise web developers
Varnish Cache Plus. Random notes for wise web developersVarnish Cache Plus. Random notes for wise web developers
Varnish Cache Plus. Random notes for wise web developers
 

Similar to 20100918 android cache

Building Lightning Fast Websites (for Twin Cities .NET User Group)
Building Lightning Fast Websites (for Twin Cities .NET User Group)Building Lightning Fast Websites (for Twin Cities .NET User Group)
Building Lightning Fast Websites (for Twin Cities .NET User Group)strommen
 
IBM dwLive, "Internet & HTTP - 잃어버린 패킷을 찾아서..."
IBM dwLive, "Internet & HTTP - 잃어버린 패킷을 찾아서..."IBM dwLive, "Internet & HTTP - 잃어버린 패킷을 찾아서..."
IBM dwLive, "Internet & HTTP - 잃어버린 패킷을 찾아서..."Dongwook Lee
 
Choosing A Proxy Server - Apachecon 2014
Choosing A Proxy Server - Apachecon 2014Choosing A Proxy Server - Apachecon 2014
Choosing A Proxy Server - Apachecon 2014bryan_call
 
AWS re:Invent 2016: Taking DevOps to the AWS Edge (CTD302)
AWS re:Invent 2016: Taking DevOps to the AWS Edge (CTD302)AWS re:Invent 2016: Taking DevOps to the AWS Edge (CTD302)
AWS re:Invent 2016: Taking DevOps to the AWS Edge (CTD302)Amazon Web Services
 
AWS re:Invent 2016: Taking DevOps to the AWS Edge (CTD302)
AWS re:Invent 2016: Taking DevOps to the AWS Edge (CTD302)AWS re:Invent 2016: Taking DevOps to the AWS Edge (CTD302)
AWS re:Invent 2016: Taking DevOps to the AWS Edge (CTD302)Amazon Web Services
 
REST Methodologies
REST MethodologiesREST Methodologies
REST Methodologiesjrodbx
 
HTTP/2 and web development practices
HTTP/2 and web development practicesHTTP/2 and web development practices
HTTP/2 and web development practicesSimone Spaccarotella
 
A Forgotten HTTP Invisibility Cloak
A Forgotten HTTP Invisibility CloakA Forgotten HTTP Invisibility Cloak
A Forgotten HTTP Invisibility CloakSoroush Dalili
 
Building & Testing Scalable Rails Applications
Building & Testing Scalable Rails ApplicationsBuilding & Testing Scalable Rails Applications
Building & Testing Scalable Rails Applicationsevilmike
 
Http - All you need to know
Http - All you need to knowHttp - All you need to know
Http - All you need to knowGökhan Şengün
 
Как Web-акселератор акселерирует ваш сайт / Александр Крижановский (Tempesta ...
Как Web-акселератор акселерирует ваш сайт / Александр Крижановский (Tempesta ...Как Web-акселератор акселерирует ваш сайт / Александр Крижановский (Tempesta ...
Как Web-акселератор акселерирует ваш сайт / Александр Крижановский (Tempesta ...Ontico
 
HTTP / 1, HTTP / 2 and HTTP / 3: Past, present and the future of APIs
HTTP / 1, HTTP / 2 and HTTP / 3: Past, present and the future of APIsHTTP / 1, HTTP / 2 and HTTP / 3: Past, present and the future of APIs
HTTP / 1, HTTP / 2 and HTTP / 3: Past, present and the future of APIsRoan Brasil Monteiro
 
.NET Conf 2022 - Networking in .NET 7
.NET Conf 2022 - Networking in .NET 7.NET Conf 2022 - Networking in .NET 7
.NET Conf 2022 - Networking in .NET 7Karel Zikmund
 

Similar to 20100918 android cache (20)

Building Lightning Fast Websites (for Twin Cities .NET User Group)
Building Lightning Fast Websites (for Twin Cities .NET User Group)Building Lightning Fast Websites (for Twin Cities .NET User Group)
Building Lightning Fast Websites (for Twin Cities .NET User Group)
 
computer networking
computer networkingcomputer networking
computer networking
 
HTTP/2 Prioritization
HTTP/2 PrioritizationHTTP/2 Prioritization
HTTP/2 Prioritization
 
Http2 in practice
Http2 in practiceHttp2 in practice
Http2 in practice
 
IBM dwLive, "Internet & HTTP - 잃어버린 패킷을 찾아서..."
IBM dwLive, "Internet & HTTP - 잃어버린 패킷을 찾아서..."IBM dwLive, "Internet & HTTP - 잃어버린 패킷을 찾아서..."
IBM dwLive, "Internet & HTTP - 잃어버린 패킷을 찾아서..."
 
Choosing A Proxy Server - Apachecon 2014
Choosing A Proxy Server - Apachecon 2014Choosing A Proxy Server - Apachecon 2014
Choosing A Proxy Server - Apachecon 2014
 
AWS re:Invent 2016: Taking DevOps to the AWS Edge (CTD302)
AWS re:Invent 2016: Taking DevOps to the AWS Edge (CTD302)AWS re:Invent 2016: Taking DevOps to the AWS Edge (CTD302)
AWS re:Invent 2016: Taking DevOps to the AWS Edge (CTD302)
 
AWS re:Invent 2016: Taking DevOps to the AWS Edge (CTD302)
AWS re:Invent 2016: Taking DevOps to the AWS Edge (CTD302)AWS re:Invent 2016: Taking DevOps to the AWS Edge (CTD302)
AWS re:Invent 2016: Taking DevOps to the AWS Edge (CTD302)
 
Otimizando servidores web
Otimizando servidores webOtimizando servidores web
Otimizando servidores web
 
REST Methodologies
REST MethodologiesREST Methodologies
REST Methodologies
 
HTTP/2 and web development practices
HTTP/2 and web development practicesHTTP/2 and web development practices
HTTP/2 and web development practices
 
Speed Matters
Speed MattersSpeed Matters
Speed Matters
 
A Forgotten HTTP Invisibility Cloak
A Forgotten HTTP Invisibility CloakA Forgotten HTTP Invisibility Cloak
A Forgotten HTTP Invisibility Cloak
 
Caching on the web
Caching on the webCaching on the web
Caching on the web
 
What's up with HTTP?
What's up with HTTP?What's up with HTTP?
What's up with HTTP?
 
Building & Testing Scalable Rails Applications
Building & Testing Scalable Rails ApplicationsBuilding & Testing Scalable Rails Applications
Building & Testing Scalable Rails Applications
 
Http - All you need to know
Http - All you need to knowHttp - All you need to know
Http - All you need to know
 
Как Web-акселератор акселерирует ваш сайт / Александр Крижановский (Tempesta ...
Как Web-акселератор акселерирует ваш сайт / Александр Крижановский (Tempesta ...Как Web-акселератор акселерирует ваш сайт / Александр Крижановский (Tempesta ...
Как Web-акселератор акселерирует ваш сайт / Александр Крижановский (Tempesta ...
 
HTTP / 1, HTTP / 2 and HTTP / 3: Past, present and the future of APIs
HTTP / 1, HTTP / 2 and HTTP / 3: Past, present and the future of APIsHTTP / 1, HTTP / 2 and HTTP / 3: Past, present and the future of APIs
HTTP / 1, HTTP / 2 and HTTP / 3: Past, present and the future of APIs
 
.NET Conf 2022 - Networking in .NET 7
.NET Conf 2022 - Networking in .NET 7.NET Conf 2022 - Networking in .NET 7
.NET Conf 2022 - Networking in .NET 7
 

20100918 android cache

  • 1. Android HTTP Cache ( ) 2010-09-18 2010-10-03
  • 2. Android HTTP • java.net • Java • HTTP HttpURLConnection • org.apache.http • Apache HttpClient 4.0 Android • HTTP • android.webkit • Android Android UI Web • HTTP Web 2010-10-03
  • 3. (HTTP ) • Android HTTP (3G 300kbps 2000kbps) • → → → 2010-10-03
  • 4. ( ) • • • ( ) • • →HTTP/1.1 Caching 2010-10-03
  • 5. HTTP/1.1 Caching • RFC2616 • Web Web • HTTP/1.1 Caching HTTP 2010-10-03
  • 6. HTTP/1.1 Caching • HTTP • If-Modified-Since • • If-None-Match • 2010-10-03
  • 7. HTTP/1.1 Caching • HTTP • Expires • • Last-Modified • If-Modified-Since • ETag • If-None- Match 2010-10-03
  • 8. HTTP/1.1 Caching • HTTP • Cache-Control • • Pragma • Proxy : no-cache 2010-10-03
  • 9. HTTP/1.1 Caching • Apache lighthttpd Web • • ( 2010-10-03
  • 10. HTTP/1.1 Caching • android.webkit HTTP/1.1 Caching • • →Apache HttpClient-Cache 2010-10-03
  • 11. Apache HttpClient-Cache • Apache HttpClient 4.1 • HTTP/1.1 Caching • alpha (2010 9 ) 2010-10-03
  • 12. Apache HttpClient-Cache • URL • http://hc.apache.org/ • Subversion URL • http://svn.apache.org/repos/asf/httpcomponents/httpclient/trunk/httpclient-cache • jar http://svn.apache.org/repos/asf/httpcomponents/httpclient/trunk/ svn get mvn package • Revision: 990924 (2010-09-05 ) 990925 Serialize NotSerializableException • Maven URL • http://repo1.maven.org/maven2/org/apache/httpcomponents/httpclient-cache/ 2010-10-03
  • 13. Apache HttpClient-Cache • Caching : org.apache.http.client.HttpClient : CachingHttpClient • DefaultHttpClient CachingHttpClient • Android Apache HttpClient 4.0 ( ) • alpha ( ) 2010-10-03
  • 14. Apache HttpClient-Cache • Cache HTTP • HTTP 1.1 • Method: GET • No Header: "Pragma" • No Header: "Cache-Control: no-store" • No Header: "Cache-Control: no-cache" • ※ org.apache.http.impl.client.cache.CacheableRequestPolicy 2010-10-03
  • 15. Android • Eclipse • Android • Java Build Path Apache HttpClient 4.1 jar 2010-10-03
  • 16. Android • Apache HttpClient-Cache HTTP • Cache Data Read/Write • • Cache Data Serialize • • ※org.apache.http.client.cache.HttpCacheStorage 2010-10-03
  • 17. CachingHttpClient DefaultHttpClient Expires: Last-Modified: 281(ms) 122(ms) Etag: File Size: 295 KB Expires: Last-Modified: 50(ms) 125(ms) Etag: File Size: 4KB Expires: Last-Modified: 200 (ms) 128 (ms) Etag: File Size: 8KB ※HTTP GET HTTP Response ※5 ※Nexus One (Android 2.2) Wi-FI ※ : http://www1.axfc.net/uploader/Sc/so/154474.zip 2010-10-03
  • 18. Caching →CachingHttpClient#execute() 2010-10-03
  • 19. Apache HttpClient-Cache • Caching Caching → HTTP Response • 2010 9 • HTTP Response Caching android.webkit 2010-10-03
  • 20. URL • HTTP/1.1: Caching in HTTP • http://www.w3.org/Protocols/rfc2616/rfc2616-sec13.html • Web • http://www.atmarkit.co.jp/fjava/rensai2/webopt12/webopt12.html • Android • http://www.ibm.com/developerworks/jp/opensource/library/os-android- networking/ 2010-10-03
  • 21. Web • http://www.amazon.co.jp/dp/4774142042 2010-10-03