open-learning-exchange / BeLL-Apps

This is the third iteration of the BeLL software. It's a Backbone.js app that caches itself in the browser that is backed by CouchDB when a server is available and PouchDB in the browser when a server is not available. Initial support for PDFs is currently implemented, support for Videos and single HTML5 Apps coming next. Tracking bugs and new features in the Wiki at the moment.
12 stars 39 forks source link

Compressing HTML resource on CouchDB when transmitting wirelessly to an Android device #953

Open kanishk1010 opened 7 years ago

kanishk1010 commented 7 years ago

The Take Home Android app requests and loads HTML resources from the BeLL-Apps server wirelessly. Since there are hundreds of files (attachments) associated with an HTML resource (app), it's a huge payload which results in very slow loading on the Android app. One way to tackle this would be to compress the files ( CouchDB attachments and metadata) into a single archive, when a particular resource is requested by an Android device. To make this happen, we would probably need to have an interface in the Bell-App which allows execution of this operation on a particular CouchDB resource on demand.

Note: One of the potential solutions I came across is an npm package called couchdb-dump which enables to perform compression,archiving and migration of CouchDB database.

leomaxi commented 7 years ago

This issue is linked to https://github.com/open-learning-exchange/take-home/issues/63 .. On take-home issue log.. We are working towards moving documents (not database) from couchdb on raspberry pi to android device..

alexkarasik commented 7 years ago

@kanish1010 What do you think of this plugin: https://github.com/oreinecke/couch-gzip?

sente commented 7 years ago

Since there are hundreds of files (attachments) associated with an HTML resource (app)

Should we be concatenating/minifying the resources?

possibly relevant: https://github.com/open-learning-exchange/BeLL-Apps/blob/dev/app/minify_html.py

Perhaps we should look into webpack, (which supports images: https://survivejs.com/webpack/loading/images/)

@kanish1010 What do you think of this plugin: https://github.com/oreinecke/couch-gzip?

The known limitations/issues make me nervous about this. Crashing for large responses, 100ms+ for every response, no SSL...

I think using nginx in front of couchdb would do the trick, see: http://nginx.org/en/docs/http/ngx_http_gzip_module.html