4 ms·
How small is the lightest sinatra app though, when deployed in a container? We lately had some experience with dockerizing a moderately complex ruby app and it
by WJW 9y ago
How small is the lightest sinatra app though, when deployed in a container? We lately had some experience with dockerizing a moderately complex ruby app and it was pretty shocking how large they get compared to simple statically linked binaries.
- jaequery 9y agoim not sure what you are asking for in terms of lightness but its incredibly light in both concept and execution. i mean it doesnt get any lighter than this. require ‘sinatra’ get ‘/‘ do “hello” end you should check out https://github.com/jaequery/jasis https://github.com/jaequery/jasis its a dockerized Sinatra app with all the bells and whistles and see how light it is yourself.
- AYBABTME 9y agoSure but no useful app can be described by this "Hello HTTP" example. I've seen the same as parent: Ruby services require a lot more memory in their steady state than say, their Go service counterpart, for a same complexity.
- jaequery 9y agoyou must be referring to Rails. sure they can be pretty big, as they are what you call a monolithic framework. thats why i recommend Sinatra for performance conscious devs, as its a fast and minimal framework. and you get to load only what you need. check the github.com/jaequery/jasis github project and peek at the Gemfile / boot.rb to see all that it loads for a full fledged mvc app. its pretty explicit and lean if you ask me. if are talking about server resource then you probably referring to the web server. for which we have ‘puma’ and it is also incredibly light and fast. much lighter than a php stack running Apache and mod_php for sure. but i see you compared to Go to which we have no comparison Go will run circles around Ruby. but Go is not really a well suited environment for web applications yet so ill just leave it at that.
- yxhuvud 9y agoYou do realize you are talking about totally different things compared to the post you answer to? You are talking amount of code, the post you are talking to are talking system resources. That is an apples to pears comparison. Sinatra may be lighter than Rails resource wise, but it is still not in any way light compared to a compiled binary. The difference is pretty staggering in practice.
- nine_k 9y agoThis very much depends on the way you build a container. If you take e.g. Alpine Linux as a base image, then build almost everything as a single step in a shell script, removing useless intermediate files, you get a pretty small image. If you take e.g. a normal Debian image and build it so that every step adds a layer, you end up with a large image.