Return-Path: Delivered-To: apmail-couchdb-dev-archive@www.apache.org Received: (qmail 51083 invoked from network); 13 Jan 2010 17:01:18 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 13 Jan 2010 17:01:18 -0000 Received: (qmail 4836 invoked by uid 500); 13 Jan 2010 17:01:18 -0000 Delivered-To: apmail-couchdb-dev-archive@couchdb.apache.org Received: (qmail 4779 invoked by uid 500); 13 Jan 2010 17:01:18 -0000 Mailing-List: contact dev-help@couchdb.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@couchdb.apache.org Delivered-To: mailing list dev@couchdb.apache.org Received: (qmail 4769 invoked by uid 99); 13 Jan 2010 17:01:18 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 13 Jan 2010 17:01:18 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.140] (HELO brutus.apache.org) (140.211.11.140) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 13 Jan 2010 17:01:15 +0000 Received: from brutus.apache.org (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id A8A0429A0013 for ; Wed, 13 Jan 2010 09:00:54 -0800 (PST) Message-ID: <1537545781.217621263402054689.JavaMail.jira@brutus.apache.org> Date: Wed, 13 Jan 2010 17:00:54 +0000 (UTC) From: "Paul Joseph Davis (JIRA)" To: dev@couchdb.apache.org Subject: [jira] Commented: (COUCHDB-583) storing attachments in compressed form and serving them in compressed form if accepted by the client In-Reply-To: <844257352.1259509400633.JavaMail.jira@brutus> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/COUCHDB-583?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12799829#action_12799829 ] Paul Joseph Davis commented on COUCHDB-583: ------------------------------------------- Just some quick thoughts reading through the diff: I'm not a fan of the file containing a list of compressible types. There are too many types that will just make that configuration hard. Not to mention exposing an entirely new API endpoint to work with those types is also needlessly complex. I'd prefer to see an automatic test trying to compress the first 4K or so of an attachment and use a heuristic to determine whether it compressed enough to justify compressing the entire attachment. If that's not doable, the compressible type system should be integrated into the current configuration mechanism. For testing from FireFox it might be best to expose a "attachment is stored in compressed form" attribute in the _attachments member. Passing around the <<"Y">> and <<"N">> binaries as a flag for an attachment being compressed is un-erlangy. true and false atoms would be better. Test code does not belong in couch_httpd.erl. Is there something I'm missing on why we need to leak couch_util:gzip* functions into couch_httpd_db.erl instead of putting all of that logic into couch_stream.erl? Is there nothing in mochiweb to handle accept-encoding parsing? Instead of naming tests test1 -> test17 and comments above each test, just use a descriptive test name. It might help to group related tests as well so that tests are easier to find. Data in the etap tests shouldn't be stored inline when its that big. Create data files and use the test helpers to reference the filenames and read from disk. > storing attachments in compressed form and serving them in compressed form if accepted by the client > ---------------------------------------------------------------------------------------------------- > > Key: COUCHDB-583 > URL: https://issues.apache.org/jira/browse/COUCHDB-583 > Project: CouchDB > Issue Type: New Feature > Components: Database Core, HTTP Interface > Environment: CouchDB trunk > Reporter: Filipe Manana > Attachments: couchdb-583-trunk-3rd-try.patch, couchdb-583-trunk-4th-try-trunk.patch, couchdb-583-trunk-5th-try.patch, couchdb-583-trunk-6th-try.patch, couchdb-583-trunk-7th-try.patch, couchdb-583-trunk-8th-try.patch, couchdb-583-trunk-9th-try.patch, jira-couchdb-583-1st-try-trunk.patch, jira-couchdb-583-2nd-try-trunk.patch > > > This feature allows Couch to gzip compress attachments as they are being received and store them in compressed form. > When a client asks for downloading an attachment (e.g. GET somedb/somedoc/attachment.txt), the attachment is sent in compressed form if the client's http request has gzip specified as a valid transfer encoding for the response (using the http header "Accept-Encoding"). Otherwise couch decompresses the attachment before sending it back to the client. > Attachments are compressed only if their MIME type matches one of those listed in a separate config file. Compression level is also configurable in the default.ini file. > This follows Damien's suggestion from 30 November: > "Perhaps we need a separate user editable ini file to specify compressable or non-compressable files (would probably be too big for the regular ini file). What do other web servers do? > Also, a potential optimization is to compress the file while writing to disk, and serve the compressed bytes directly to clients that can handle it, and decompressed for those that can't. For compressable types, it's a win for both disk IO for reads and writes, and CPU on read." > Patch attached. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.