Using serverside compression to improve Tiddlywiki load time

in utopian-io •  7 years ago 

I have a tiddlywiki nodejs service running in my personal server in order to manage my notes anywhere. Tiddlywiki has easily become part of my daily life and has come to replace propietary software that compromises my privacy like google docs. However, it is quite risky to run your own services because you must maintain you server updated and be aware of the latest vulnerabilities, so in terms of usability, a propietary software might just be better because it would just work. But for those of us that like to just DIY, TW is a great tool that can be self hosted.

After installing some plugins and themes and adding some notes, my tiddlywiki notebook has grown to about 5 MB. Sometimes loading time for this is a bit slow, of about 23 seconds or so in a normal connection and some more with mobile internet. Now, this is not that much, I mean, I can wait a few seconds without dying. But since we live in a fast changing environment rushing through life just to go online and get stuff done, I figured I could lower this time by putting this service behind nginx so it is compressed on the server side.

image.png

So doing some research, I found this nginx module that does compression.

I added the following server configuration:

server {
     listen 1234;
     location / {
        proxy_set_header   X-Real-IP $remote_addr;
        proxy_set_header   Host      $http_host;
        proxy_pass         http://127.0.0.1:1005;
        gzip            on;
        gzip_proxied    expired no-cache no-store private auth;
     }
}

I had to do some proxy configuring with proxy_set_header and proxy_pass so it copies the connection remote address (this is the client) and the host name to the local host address. Since we are using a proxy configuration and it handles basic authentication, I've added gzip_proxied with some options that avoids the content to be cached.

By doing this I managed to improve loading time to about 6 seconds, which is a big difference.

image.png

Next thing I want to do with this is to put a SSL certificate and enable the secure http protocol by using letsencrypt.



Posted on Utopian.io - Rewarding Open Source Contributors

Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!
Sort Order:  

Thank you for the contribution. It has been approved.

You can contact us on Discord.
[utopian-moderator]

Thanks !

Hey @elguille I am @utopian-io. I have just upvoted you!

Achievements

  • You have less than 500 followers. Just gave you a gift to help you succeed!
  • Seems like you contribute quite often. AMAZING!

Suggestions

  • Contribute more often to get higher and higher rewards. I wish to see you often!
  • Work on your followers to increase the votes/rewards. I follow what humans do and my vote is mainly based on that. Good luck!

Get Noticed!

  • Did you know project owners can manually vote with their own voting power or by voting power delegated to their projects? Ask the project owner to review your contributions!

Community-Driven Witness!

I am the first and only Steem Community-Driven Witness. Participate on Discord. Lets GROW TOGETHER!

mooncryption-utopian-witness-gif

Up-vote this comment to grow my power and help Open Source contributions like this one. Want to chat? Join me on Discord https://discord.gg/Pc8HG9x