4 ms·
I think a lot of web servers will automatically gzip data if the client accepts it. You might not even have to do anything config wise if this is for a website
by codetrotter 2y ago
I think a lot of web servers will automatically gzip data if the client accepts it.
You might not even have to do anything config wise if this is for a website and normal web browsers.
If it’s for an app, it might depend on what client library you use but even then I guess a lot of them will automatically support that for you without any special configuration required.
- dylan604 2y agoI just took a look at my httpd.conf, and the deflate module is being loaded, but there was no directive on what file types to apply it to that I could find. I'll have to set up a couple of tests to see the before/after of enabling it for a specific file type I'll have to leave myself a comment in the conf file to remind me that I got a little tech support on a divergent bit of comments on a post about interesting CSS anims =)
- tecleandor 2y agoAlso, instead of compressing files live on every request, you can pre-compress them, put them next to the uncompressed files with the same name but .gz extension, and tell your server to serve those if the client support it [0]. Useful in case of bigger files (so you don't have to compress them on request), and also if you want to use a higher compression level: you're only going to compress them once, not on every request, so you can use a bit more CPU on making them a bit smaller. -- 0: https://httpd.apache.org/docs/2.4/mod/mod_deflate.html#precompressed (I guess you're using Apache, but other servers can do it too)
- dylan604 2y agoUnfortunately, the specific thing I was looking to compress are reports generated live, and are then removed with a TTL type policy. I would however definitely be interested in having the site's .js files delivered as .gz files. This has been something I have always been curious about and had as a TODO item, but I think this discussion will move it up on my priority list. Luckily, we are a very small site with a laughably small set of users. But nothing wrong with using best practices even so I appreciate everyone's suggestions
- Folcon 2y agoI'm going to be honest, given your attitude to this as seen in this thread, even if you don't consider yourself full-stack right now, it looks like it's only a matter of time. You've got the important skill, asking questions and being willing to try, learn and get your hands a little bit dirty =)...
- dylan604 2y agoIt's funny in that every job I've had since 1999 I have done some sort of bringing up a LAMP stack in some form or fashion. I know enough to search for each new flavor of Linux each place has used, but I would never consider myself nor insult actual full stack peeps by calling myself a full stack person. I'd fail any interview for that kind of position. Then again, I'd say that for all of the other roles I've ever had. They were all self taught while learning on the job by learning from more experienced coworkers. I know enough to get something done, but I'd never have full faith that it would survive any kind of scrutiny other than it accomplished the task at hand.