Mobile/Janus: Difference between revisions

3,550 bytes added ,  15 January 2015
 
(25 intermediate revisions by 2 users not shown)
Line 1: Line 1:
<big><big>'''The Janus proxy experiment has ended.


The code remains on [https://github.com/mozilla/node-janus github], but we are no longer actively developing it.'''</big></big>


Janus is a project to find and evaluate ways to enable more efficient mobile browsing.
 
 
 
 
 
 
 
 
 
 
 
== Overview ==
'''Janus is a compression and privacy proxy ''' with the goal to provide more secure and efficient mobile browsing.
The [https://wiki.mozilla.org/index.php?title=Mobile/Janus#Goals goals section] gives some details on our objectives and the ways we want to achieve them.
 
The Janus Proxy is currently using the experimental [http://www.chromium.org/spdy/spdy-whitepaper SPDY protocol] but will use the upcoming new [http://tools.ietf.org/html/draft-ietf-httpbis-http2-13 HTTP/2] standard when it is finalized.
 
The proxy does compress and re-encode media files using techniques described in the [https://wiki.mozilla.org/index.php?title=Mobile/Janus#Features features section].
 
=== Communication Channels ===
==== Chat ====
You can reach the developers of the proxy on the '''#janus''' channel on the Mozilla IRC network.
==== Mailing List ====
For asynchronous discussions, use the [https://mail.mozilla.org/listinfo/janus-dev janus-dev] mailing list.
==== Bug Reports ====
The easiest way to report bugs is using the '''Report Bug''' feature on the Janus add-on. That would report your client settings and the additional information you provide to give us enough context to reproduce the issue.
Alternatively, you can directly create a [https://github.com/mozilla/node-janus/issues GitHub issue] to report the problem you've encountered. Please make sure to provide explicit ''steps to reproduce'' the issue and also note your client configuration and browser version.
 
=== Janus Proxy ===
The [https://github.com/mozilla/node-janus Janus Proxy source code] is hosted on GitHub. 
We are using [https://github.com/mozilla/node-janus/issues GitHub issues] to track bugs and features.
 
=== Firefox (for Android) ===
The Janus Proxy requires secure SPDY (soon HTTP/2) proxy support on the browser, which are supported on Firefox 33 and up. 
Currently (August 2014), the supported Firefox versions are served on the [https://www.mozilla.org/en-US/firefox/channel/#aurora Aurora] or [http://nightly.mozilla.org Nightly] channels.
 
Required or desired '''features''' that Janus could utilize are tracked here
* {{bug|378637}} - Add support for connecting to HTTP proxy over HTTPS
* {{bug|366559}} - Firefox/Gecko should support LZMA as an HTTP transfer-encoding method
* {{bug|1010068}} - Disable OCSP on Firefox for Android
* {{Bug|944117}} - Implement support for WebM Alpha
 
Known '''issues''' affecting Janus are tracked here
* {{bug|1014589}} - Fennec crashes on page load when connected with SPDY proxy
* {{Bug|1047485}} - HTTPS sites slow when SPDY proxy in use
* {{Bug|1025582}} - CORS request intermittently fails after refreshing page rapidly
 
=== Janus Add-On ===
To make the configuration of the proxy easier, we provide the [https://github.com/mozilla/janus-addon Janus add-on] for your Firefox (for Android) browser.
The add-on settings give you also more control over the desired behavior of the proxy like compression levels and give you access to some experimental features.
 
=== Firefox OS ===
We are also working on providing support for the proxy on Firefox OS, the progress is being tracked in {{Bug|1041389}}.


== Goals ==
== Goals ==
The goal of Janus is to verify whether we can enhance the mobile browsing experience by achieving the following improvements in a practical way:
The main goal of the Janus Proxy is to provide a better mobile browsing experience by '''enhancing privacy''', '''reducing the download sizes''' of web content and therefore '''decrease load times''' on slow connections.
* Reduce radio time
 
* Reduce page load times
Here are our objectives:
* Reduce bandwidth requirements
* Increase user privacy ''by encryption''
* '''Increase user privacy'''
* Reduce bandwidth requirements ''by data compression''
* Increase responsiveness for slow sites
* Reduce page load times on slow connections ''using efficient transmission protocols''
 
The potential advantages for users are
* Encryption of traffic on insecure WiFi networks
* Increased mileage on limited data plans
* Faster browsing on slow connections
 
== Features ==
To achieve the [https://wiki.mozilla.org/index.php?title=Mobile/Janus#Goals goals], we discuss the features of the Janus Proxy and their implementation statuses in this section.
 
=== Status ===
{| class="wikitable"
|-
! Feature !! colspan="5"|Status !! Version !! See also
|-
| [[Mobile/Janus#Transmission_Protocol|SPDY]] || {{JanusFeatureStatus|i|Proxy}} || {{JanusFeatureStatus|i|Add-on}} || {{JanusFeatureStatus|i|Fennec}} || {{JanusFeatureStatus|i|Desktop}} || {{JanusFeatureStatus|ni|B2G}} || 0.1 || {{bug|378637}} [http://www.chromium.org/spdy/spdy-whitepaper spec]
|-
| [[Mobile/Janus#Transmission_Protocol|HTTP/2]] || {{JanusFeatureStatus|ni|Proxy}} || {{JanusFeatureStatus|ni|Add-on}} || {{JanusFeatureStatus|i|Fennec}} || {{JanusFeatureStatus|i|Desktop}} || {{JanusFeatureStatus|ni|B2G}} ||  || [http://tools.ietf.org/html/draft-ietf-httpbis-http2-14 spec]
|-
| [[Mobile/Janus#Text_Compression|Text compression / gzip]] || {{JanusFeatureStatus|i|Proxy}} || {{JanusFeatureStatus|i|Add-on}} || {{JanusFeatureStatus|i|Fennec}} || {{JanusFeatureStatus|i|Desktop}} || {{JanusFeatureStatus|ni|B2G}} || 0.2 ||
|-
| [[Mobile/Janus#Text_Compression|Text compression / xz]] || {{JanusFeatureStatus|off|Proxy}} || {{JanusFeatureStatus|ni|Add-on}} || {{JanusFeatureStatus|ni|Fennec}} || {{JanusFeatureStatus|ni|Desktop}} || {{JanusFeatureStatus|ni|B2G}} || 0.3 || {{bug|366559}} {{gh|mozilla|node-janus|13}}
|-
| [[Mobile/Janus#Image_Compression|Image compression / libjpeg-turbo]] || {{JanusFeatureStatus|i|Proxy}} || {{JanusFeatureStatus|i|Add-on}} ||  ||  ||  || 0.4  ||
|-
| [[Mobile/Janus#Image_Compression|Image compression / mozjpeg]] || {{JanusFeatureStatus|off|Proxy}} || {{JanusFeatureStatus|i|Add-on}} ||  ||  ||  || 0.2  || {{Bug|500500}} {{gh|mozilla|node-janus|34}}
|-
| [[Mobile/Janus#Image_Compression|Image compression / pngquant]] || {{JanusFeatureStatus|i|Proxy}} || {{JanusFeatureStatus|i|Add-on}} ||  ||  ||  || 0.4  ||
|-
| [[GIF to video]] || {{JanusFeatureStatus|i|Proxy}} ||{{JanusFeatureStatus|off|Add-on}} || {{JanusFeatureStatus|i|Fennec}} || {{JanusFeatureStatus|i|Desktop}} || {{JanusFeatureStatus|ni|B2G}} || 0.2  || {{gh|mozilla|node-janus|16}}
|-
| [[Video compression / H.264]] || {{JanusFeatureStatus|i|Proxy}} || {{JanusFeatureStatus|ni|Add-on}} ||  ||  ||  || 0.4 || {{gh|mozilla|node-janus|48}} {{gh|mozilla|node-janus|49}}
|-
| [[Adblock]] || {{JanusFeatureStatus|i|Proxy}} || {{JanusFeatureStatus|off|Add-on}} ||  ||  ||  || 0.2  ||
|-
| [[Mobile/Janus#Caching|Caching]] || {{JanusFeatureStatus|off|Proxy}} ||{{JanusFeatureStatus|off|Add-on}} ||  ||  ||  || 0.2  || {{gh|mozilla|node-janus|42}} {{gh|mozilla|node-janus|3}}
|-
| [[Safe Browsing]] || {{JanusFeatureStatus|ni|Proxy}} || {{JanusFeatureStatus|ni|Add-on}} ||  ||  ||  ||  ||
|-
| [[Dynamic compression rate ]] || {{JanusFeatureStatus|ni|Proxy}} ||{{JanusFeatureStatus|ni|Add-on}} ||  ||  ||  ||  ||
|-
| [[Mobile/Janus#Metrics|Metrics]] || {{JanusFeatureStatus|i|Proxy}} || ||  ||  ||  || 0.3 || {{gh|mozilla|node-janus|45}} {{gh|mozilla|node-janus|32}} {{gh|mozilla|node-janus|30}} {{gh|mozilla|node-janus|28}} {{gh|mozilla|node-janus|24}} {{gh|mozilla|node-janus|12}} [https://github.com/mozilla/statsd-console-backend statsd-console-backend]
|-
| [[Mobile/Janus#Metrics|Metrics / memory and GC]] || {{JanusFeatureStatus|i|Proxy}} || ||  ||  ||  || 0.4 || {{gh|mozilla|node-janus|52}}
|-
| [[Mobile/Janus#Tests|Tests / performance]] || {{JanusFeatureStatus|i|Proxy}} || ||  ||  ||  ||  || {{gh|mozilla|node-janus|53}}
|-
| [[Mobile/Janus#Bug_Reports|Bug reports]] || {{JanusFeatureStatus|i|Proxy}} || {{JanusFeatureStatus|i|Add-on}} ||  ||  ||  || 0.3 || {{gh|mozilla|node-janus|38}}
|}
 
<!--
{{gh|mozilla|node-janus|}}
{{JanusFeatureStatus|STATUS|PLATFORM}}
 
STATUS = np | i | ni | off
PLATFORM = Proxy | Desktop | Android | B2G
-->
 
=== Open Issues (suitable for contributors) ===
If you want to contribute to the project and don't know where to start, this list should give you an idea of what we are currently working on or planning to.
Alternatively, you may also directly pick a [[Mobile/Janus#Feature|feature]] to improve or an [https://github.com/mozilla/node-janus/issues issue] to attack.
 
{| class="wikitable"
|-
! Issue !! Description !! Mentors !! See also
|-
| HTTP/2 || Migrate to HTTP/2, adjust handling, test for regressions || snorp, esawin || {{gh|mozilla|node-janus|15}} [https://github.com/molnarg/node-http2 node-http2]
|-
| Add-on || Update to HTTPS PAC, fix/remove scrollbar on Linux, add quality control settings || snorp, esawin || {{gh|mozilla|node-janus|67}} [https://github.com/mozilla/janus-addon janus-addon]
|-
| Image worker || Fix image-worker issues, rewrite to TCP/HTTP interface, enable per-request settings || sylvain, esawin || {{gh|mozilla|janus-image-worker|2}}
|}
 
=== Transmission Protocol ===
Routing requests through a SPDY proxy does require less open TCP connections (multiplexing), decreases packet sizes (header compression) and reduces the number of packets (header caching) compared to HTTP/1.1. Low bandwidth and high latency connections should benefit from this.
 
=== Image Compression ===
The current trend on the Web shows an increase in average page size, especially due to high-resolution images. Additional image compression and downsizing should decrease the bandwidth requirements and enable faster page loads.
We want to reduce images sizes with no noticeable quality degradation, or with a dynamic quality setting controlled by the user.


Ways we hope to accomplish some of these things:
=== Text Compression ===
* Recompress images to be smaller without noticeable visual impact
We use '''gzip''' and possibly '''xz'''. ''TODO''
* Compress text (js, html) streams (gzip, bzip2, lzma?)
* Caching
* Reduce HTTPS round trips
* Move safe browsing support to the proxy
* Link prefetching


Other crazy stuff we could do:
=== Caching ===
''TODO''
 
=== Safe Browsing ===
''TODO''
 
=== Other ===
Other '''crazy''' stuff we could (technically) do:
* Man-in-the-middle HTTPS traffic only for images (so they get recompressed) with user consent
* Man-in-the-middle HTTPS traffic only for images (so they get recompressed) with user consent
* Convert animated GIF to H264/WebM/whatever. gfycat.com does this now with apparently good results
* Convert animated GIF to H264/WebM/whatever. gfycat.com does this now with apparently good results
* Pre-Shumwayize Flash content
* Pre-Shumwayize Flash content
* Automatic readability mode for some sites
* Automatic readability mode for some sites
* Ad blocking
** Only obnoxious ads?
** Replace with our own?
** Only block ones that track?
* Add support for adaptive streaming (MPEG-DASH) for servers that don't support it. Transcode to lower bitrates.
* Add support for adaptive streaming (MPEG-DASH) for servers that don't support it. Transcode to lower bitrates.
** Proxy HLS sites as MPEG-DASH
** Proxy HLS sites as MPEG-DASH
* Opera Mini-like pre-rendering of pages
* Pre-rendering of pages


Taras crazy stuff:
Taras crazy stuff:
Line 46: Line 176:
** server could spdy-push partial files(eg only css that gets used) + zsync of rest of contents so client can request missing pieces for other pages on the website(this can hugely reduce transfer sizes)...If i remember correctly from https://bugzilla.mozilla.org/show_bug.cgi?id=834865 70%+ of css is leftover cruft...Note this might be easier to do having sites be aware of this and bundling a library that supports having css/js broken up into multiple files & supports waiting on missing pieces
** server could spdy-push partial files(eg only css that gets used) + zsync of rest of contents so client can request missing pieces for other pages on the website(this can hugely reduce transfer sizes)...If i remember correctly from https://bugzilla.mozilla.org/show_bug.cgi?id=834865 70%+ of css is leftover cruft...Note this might be easier to do having sites be aware of this and bundling a library that supports having css/js broken up into multiple files & supports waiting on missing pieces


== Implementation ==
== Research ==
 
We've started out implementing the proxy server using Node. It uses existing SPDY and HTTP2 libraries, and is relatively good at dealing with streamed data. Development occurs in GitHub here: https://github.com/mozilla/node-janus
 
We also have a mailing list where folks can talk about all things related to the project: https://mail.mozilla.org/listinfo/janus-dev
 
== Background ==
<!--
=== HTTP ===
''TODO''
-->
=== Transport Layer Security (TLS) ===
==== TLS handshake ====
<code>
'''Time''' [ms]            '''Client'''      '''Server'''
30                      SYN  -->                         
60                            <--  SYN ACK
90                      ACK  -->
120                          <--  Certificate
150        ChangeChiperSpec  -->
180                          <--  ChangeCipherSpec
210                    Data  --> 
240                          <--  Data
</code>
<!--
=== SPDY ===
''TODO''
 
=== WiFi ===
''TODO''
-->
=== 3G/4G ===
==== LTE Mobile Network ====
<code>
'''Latency''' [ms]  '''Type'''            '''Device'''      '''RAN'''      '''Core Network'''            '''Internet'''
                                                    '''SGW'''    '''MME'''    '''PGW'''         
<100          control plane          <-->
<5            user plane            <-->
30-100        backbone                        <-->
variable      routing                                                  <-->
</code>
 
==== Control Plane Latency ====
<code>
                '''GPRS    EDGE    HSPA  HSPA+  LTE    LTE-Advanced'''
'''Latency''' [ms]  <1000  <1000  <500  <200    <100  <50
</code>
<!--
==== Radio Access Network (RAN) ====
''TODO''
 
==== Radio Resource Controller (RRC) ====
''TODO''
 
==== Packet Gateway (PGW) ====
''TODO''
 
==== Serving Gateway (SGW) ====
''TODO''
 
==== Mobility Management Entity (MME) ====
''TODO''
-->
=== Image Compression ===
=== Image Compression ===


Line 252: Line 320:
==== Bandwidth is the decisive factor for page load speed ====
==== Bandwidth is the decisive factor for page load speed ====
Bandwidth gives the upper bound on transmission speed under optimal conditions. In realistic environments, considering the speed of light and the shortcomings of the transmission protocol, ''latency'' is the limiting factor for the maximum throughput.
Bandwidth gives the upper bound on transmission speed under optimal conditions. In realistic environments, considering the speed of light and the shortcomings of the transmission protocol, ''latency'' is the limiting factor for the maximum throughput.
== Tracking Bugs ==
The Node.js based proxy implementation is maintained on GitHub: [https://github.com/mozilla/node-gonzales node-gonzales]. Please use it to report issues and make pull requests.
Required '''features''' that Janus depends on are tracked here
* {{bug|378637}} - Add support for connecting to HTTP proxy over HTTPS
* {{bug|366559}} - Firefox/Gecko should support LZMA as an HTTP transfer-encoding method
* {{bug|1010068}} - Disable OCSP on Firefox for Android
Known '''issues''' affecting Janus are tracked here
* {{bug|1014589}} - Fennec crashes on page load when connected with SPDY proxy
== System Overview ==
Janus is a secure proxy server that accepts requests via the SPDY protocol and serves compressed content directly from its cache, if available.
<code>
Browser <-SPDY-> Janus                                <-HTTP/HTTPS/SPDY-> Web
                |                                        |
                Proxy <-> Cache <-?-> Compressor <-> Loader
</code>
Routing requests through a SPDY proxy does require less open TCP connections (multiplexing), decreases packet sizes (header compression) and reduces the number of packets (header caching) compared to HTTP/1. Low bandwidth and high latency connections should benefit from this.
The current trend on the Web shows an increase in average page size, especially due to high-resolution images. Additional image compression and downsizing should decrease the bandwidth requirements and enable faster page loads. To counteract the introduced processing overhead and boost load times for slow pages, we add intermediate caching for the compressed results.
== Experimental Setups ==
To evaluate the system, we test each component in isolation first.
We identify third-party systems suitable for integration into the prototype and evaluate them. All qualified systems will be considered for integration or as the base of our final implementation.
=== SPDY Proxy ===
Currently, only Google Chrome supports secure SPDY proxies, but it requires valid certificates, which makes it unsuitable for testing. We bypass the missing support by using '''shrpx''' in client mode as a ''forward proxy'', and that way simulate SPDY support on any client.
Dependencies:
* Firefox/Fennec
* Spdylay (http://tatsuhiro-t.github.io/spdylay)
* Squid (http://www.squid-cache.org)
* [alternative] Node SPDY proxy (https://github.com/igrigorik/node-spdyproxy)
Here are some experimental setups.
==== P1 ====
In this setup, we connect a desktop browser via HTTP with a local forwarding proxy, which establishes a SPDY connection with the remote secure SPDY proxy. The secure SDPY proxy connects to a local web proxy to fetch the documents.
<code>
Desktop Client              <-SPDY-> SPDY Proxy <-HTTP-> Web Proxy <-HTTP-> Web
                              |      |            |      |          |
Firefox <-HTTP-> [shrpx -k -p]      --[shrpx -s]--      ----Squid----
</code>
==== P2 ====
This setup is similar to P1, but running on a mobile client. This requires either direct secure SPDY proxy support on the mobile browser, or the usage of a local forwarding proxy running on the mobile device.
<code>
Mobile Client              <-SPDY-> SPDY Proxy <-HTTP-> Web Proxy <-HTTP-> Web
                            |      |            |      |          |
Fennec <-HTTP-> [shrpx -k -p]      --[shrpx -s]--      ----Squid----
</code>
=== Compression ===
''TODO''
=== Caching ===
''TODO''


== Performance Analysis ==
== Performance Analysis ==
Let's collect some ideas here how to profile our prototypes.
Let's collect some ideas here how to profile the prototype.


Could be useful:
Could be useful:
Line 326: Line 331:
* [http://www.ietf.org/rfc/rfc2187.txt Application of Internet Cache Protocol (ICP)]
* [http://www.ietf.org/rfc/rfc2187.txt Application of Internet Cache Protocol (ICP)]
* [http://tools.ietf.org/html/rfc2616 HTTP/1.1]
* [http://tools.ietf.org/html/rfc2616 HTTP/1.1]
* [http://tools.ietf.org/html/draft-ietf-httpbis-http2-13 HTTP/2]
* [http://www.chromium.org/spdy/spdy-whitepaper SPDY]
* [http://tools.ietf.org/html/draft-ietf-httpbis-http2-14 HTTP/2]
* [http://tools.ietf.org/id/draft-agl-tls-nextprotoneg-00.txt Transport Layer Security (TLS) Next Protocol Negotiation Extension (NPN)]
* [http://tools.ietf.org/id/draft-agl-tls-nextprotoneg-00.txt Transport Layer Security (TLS) Next Protocol Negotiation Extension (NPN)]
* [http://www.chromium.org/spdy/spdy-proxy Chromium SPDY Proxy]
* [http://www.chromium.org/spdy/spdy-proxy Chromium SPDY Proxy]
Confirmed users
438

edits