Archive

Archive for the ‘News’ Category

Changes in my open source life

February 15th, 2015 Comments off

TL;DR

I’m struggling with burnout, to fix it I decided to change my life, got part time job at Try Catch, decided to stop spending all my time on supporting RVM 1 and instead in freed time finish developing RVM 2. RVM 1 maintainers needed.

Open source

Before open source I was a bit unhappy, spending big part of my week in work. I was not depressed, just still not where I wanted to be. This unhappiness was pushing me to find things that made me happy – and open source was it. I was spending a lot of my after work time to be happy – helping people was the solution. So when I got chance to ditch work and do full time open source I was very happy. This continued for long time, I was solving problems, making people happy by helping them. I have noticed larger problems and thought of solving them, this is when I planned RVM 2 a rewrite that was supposed to fix many problems developers struggled in the setup phase of projects and development/production environments. I got money from community and started working, the feature looked bright.

Burnout

But then I was caught by trap of my own creation, I still wanted RVM 1 to work great, to be useful before RVM 2 is finished. Every time I started working on the second version I was distracted by problems of first version. With time this broke me and in the end I was unable to focus on version two. As the only developer on multiple projects I was continuing to help to solve existing problems. I even thought on changing projects I’m involved, I got into working with veewee. This helped for short time and I was able to help both veewee and to work on RVM 2, but soon the disruption wear off and I wasn’t unable to do anything else but support RVM 1. Part of the problem was I was to good in support, new people were not coming to help me, I was doing it all alone. Doing everything alone took a toll on me, I was struggling with burnout. Some weeks were good, some less. I was considering different paths I can take and how to get back in the game of development.

Solutions

In the end I have decided to cut down my support time, really cut it down to a few hours a week. Assuming the projects I’m involved are worth for others someone will pick it up and help with them. There are also alternatives to most of the code I am maintaining, people can migrate to the other projects, now it’s up to the community to step up and help me – help them self to manage the projects. I also decided to get back to working with people by getting a part time job. It happened I got contacted by an amazing startup – Try Catch – which is aligned with my personality, they want to help people. I see it as a great opportunity to get back into the development game. For start I’m working in 80% capacity – so I still can have time to focus on open source. Especially I want to focus in the remaining time on finishing RVM 2, I still have almost half of the money from the fundraiser. There is already a lot of code and putting it all together is only question of spending some quality time with it.

Excitement

I’m very excited to work with Try Catch. As I was looking to get a Ruby job it was very hard to find something really interesting and company I would like to work with. I was getting contacted by multiple headhunters, they were trying to fit me into the job openings they had, but they treated me only as meat, they did not consider searching opening for me. When I got contacted by Try Catch I was very skeptical, my thoughts were “another headhunter agency”, but after few minutes I realized they reverse the process, they search for proper position for developer, not try to push him to current openings. I have spent last week working with Try Catch and it only cemented my good feelings about the company and our future. I’m also very excited to get back into developing RVM 2, I have still the same strong feelings about solving problems with RVM 2.

The feature looks bright again!

For information on helping with open source projects I’m involved with check RVM 1 maintainers needed.

Categories: Development, News Tags: , , , ,

RVM 2.0 Fundraiser halfway

October 30th, 2013 Comments off

Hello Ruby Lovers,

First off, I want to thank everyone who has donated to the RVM 2.0 fundraiser so far. Every contribution counts and I appreciate them all, no matter how small! I would also like to thank EngineYard for their sponsorship of RVM over the last two years, which has allowed me to add:

  • tests,
  • stable releases,
  • ruby binaries, and
  • automatic dependency installation (autolibs)

…among many others.

Working solely on RVM 1.x for the last few years has given me a unique view into the Ruby community. I discovered some of the most common issues users run into and tried to address them in RVM by automating installation and configuration to improve everyone’s experience with Ruby (both newcomers and experienced developers).

It was also during this time that I realized that maintaining a huge project in shell (20,000 lines) isn’t possible — it’s hard to separate modules, it’s hard to test, and advanced algorithms either slow down or need to be simplified to shell coding limitations. All of these lead to the idea of rewriting RVM in Ruby.

Initially, I resisted the idea of rewriting RVM in Ruby since there were some ideas touching static ZSH. However, thanks to DRUG, I was convinced. It seemed all the elements were in place, most importantly, binary rubies which are required for easy bootstrapping. As such, I came up with the RVM 2.0 slogan: “with RVM 2.0, you get one Ruby for free”.

I believe in Ruby. I believe it can be used for more than just web applications. We have a vast ecosystem of gems and Ruby implementations and we are constantly discovering new ways to use Ruby, like Rubinius X, JRuby 9k and Shoes 4. I want RVM 2.0 to become one of those projects that shapes the future of Ruby, and with your help, it can.

If you use RVM personally, please show your support. If you use RVM at work, please encourage your employer to show their support. Everything counts!

https://www.bountysource.com/fundraisers/489-rvm-2-0

Cheers,
Michal

Categories: Development, News Tags: , ,

what you should know about rbenv and RVM

November 1st, 2011 14 comments

By now you have most likely heard of RVM and rbenv. (There is no mistake in writing one in uppercase and second in lowercase, Iím just following conventions given by their respective authors.) As a contributor in the RVM Project I thought I could find out what really rbenv does. Reading the sources gave me some insights into rbenv – unfortunately there was no new shell trick to learn for me from rbenv. Still I could understand how it works and find differences between the two tools. Both claim, and do provide, a way to switch the currently active ruby.

The main difference between them is when the ruby is switched.

  • For RVM, itís during changing directories – the process is done once, and from now on the shell already has all ruby and gem binaries available. This can also be triggered manually.
  • For rbenv, all ruby and gem binaries are always available in shell but will load proper code only when in proper context – so switching is done each time any binary is executed.

Going into more details: RVM will take about 60ms on every called cd, which means you would need to type over 16 cd commands to take a whole second – try to do that. During the directory change, RVM will set up environment variables to reflect your ruby and gemset selection allowing it to be separated from other rubies and gems, or binaries. You will not be able to run any other binary or gem available in another project, and any auto-loading mechanisms using plugins will not be able to load them from other project environment.

For rbenv, switching directories with cd takes no time (0ms) so it is faster by default for changing directories. After installing some gems, you need to rehash and it takes 60ms. Using ruby or switching to a project dir does not change the userís environment almost at all, except for the RBENV_VERSION variable for current – but it does not mean the env is not set at all – it will be set internally every time ruby and any other ruby or gem binary is run – with a overhead of about 50ms for each invocation.

To explain in depth what rbenv does here is a quote I was originally going to put in here but I already posted the message on reddit:

There is one big hole in shims approach – it makes all the gem and ruby binaries available in your shell … just not always functional.

Having something installed in one ruby (like haml) will make it shim available in all rubies – just not working.

Shim approach is working against the system – building another abstraction layer not respecting UNIX mechanisms – like PATH search – just fooling your system (and you).

It is not possible to run a shim/ruby without rbenv loaded – it s required to to make the environment working as expected – in contrary RVM by default builds environment files which sourced once make your system aware of the exact combination of ruby and gems you want to use.

The environment is set and provided to the ran binary in both cases, only the burden of loading it is shifted, and it means:

  • The loading place makes some difference. In RVM, you can check the state of the environment with Ďrvm infoí. For rbenv, there are no changes – so there is nothing to check.
  • For RVM, only the selected ruby/gemset related binaries will be available in the shell. In rbenv, all binaries of all rubies and gems all always available in shell – only they will do nothing when called, it is not possible to check if binary exists in system as the checks always will hit the shim binary and report it as existing.
  • For those concerned about loading and execution time, you can not see the difference. It can be only measured. Anything that occurs at or below 300ms in a shell is imperceptible.

Sam Stephenson provided a list of points that make a difference between the tools, lets consider them:

  1. Need to be loaded into your shell. Instead, rbenv’s shim approach works by adding a directory to your $PATH.
    RVM also does not have to be loaded as a function. It allows operation by loading only the environment file, which is done only once and allows single and fast initialization of the current ruby and gemset. RVM also allows operation as a binary when all itís functionalities are available (except changing environment other than setting default, which behaves identically to rbenvís only means of operation).
  2. Override shell commands like cd. That’s dangerous and error-prone.
    Overriding of cd is optional. I searchied for almost 8 hours collectively over the last month to find a project that overrides cd – guess what, I could not find one. There are few shell tricks that allow you to override cd, but as cd override is optional, you can do it in your own function merged with the tricks. As for error prone – I see no reports of errors about the cd function. Once it is done, nothing bad can happen. Additoinally RVM provides a security feature whereby you can view the code to be executed ahead of time upon cd and choose to trust it or not.
  3. Have a configuration file. There’s nothing to configure except which version of Ruby you want to use.
    rbenv, at present, allows setting over 4 shell variables which influence the running process, there is no configuration file that could collect them – they have to be set in your shell rc files – for every shell you use.
  4. Install Ruby. You can build and install Ruby yourself, or use ruby-build to automate the process.
    During itís life RVM collected lots of knowledge how to manage and install rubies – including patches that make ruby work as expected on different environments. Also supporting fancy things like golf ruby – where original ruby binary is replaced with goruby binary. Why would you not want to capitalize on otherís experience?
  5. Manage gemsets. Bundler is a better way to manage application dependencies. If you have projects that are not yet using Bundler you can install the rbenv-gemset plugin.
    Using gemsets is optional but encouraged as it helps in the separation process, some gems force use of bundler but this does not solve all the separation problems. And the pure existence of rbenv-gemsets proves how useful it is. Even bundler is not impervious to plethora of installed system level gems and their oddities of interaction.
  6. Require changes to Ruby libraries for compatibility. The simplicity of rbenv means as long as it’s in your $PATH, nothing else needs to know about it.
    RVM does not require changes to any gems/libraries although it allows some additions that are meant to make life easier – like per project changing PATH for bundler generated binaries, or allowing set :rvm_ruby_string to specify a ruby version instead of setting PATH like rbenv requires. All those things are optional and not required for proper work neither of RVM or the tool concerned. Finally, separation of gemsets in RVM allows skipping calls to bundle exec – which in case of rbenv will be required (unless using my gem rubygems-bundler gem or other such tricks).
  7. Prompt you with warnings when you switch to a project. Instead of executing arbitrary code, rbenv reads just the version name from each project. There’s nothing to “trust.”
    All the warnings appear only when users create the .rvmrc file manually, if it is created automatically with the –rvmrc flag then a lot less warnings are printed. rbenv actually prints a warning when switching to a project which wants to use ruby that is not installed. Trusting of .rvmrc files can be easily switched to not read them at all or to trust any .rvmrc file.

Opposed to Sam Stephenson points above I would like to give my counterarguments for using rbenv:

  1. Execution of any binary is 50ms slower as compared to binaries run in rvm – so if you are using many calls to ruby – this might get in your way of your performance.
  2. Execution of any binary does not require proper ruby/gem to be available, it will silently fail without any warning if it is not available.
  3. It is not possible to check if ruby or gem binary is available in the system, separate calls to gem, binaries or rbenv are required to find out if it is really available – which adds more work you have to do / worry about. With RVM you set environment – and LINUX conventions allow it to work as expected, with rbenv – the environment is faked with shims, you never know (by linux conventions) what will happen.

So summing up the tools are different but they allow developers to do almost exactly the same thing just with different approaches, knowing the differences could help developers chose the right tool for the right job.

Important point mentioned quite often when RVM and rbenv is compared is the size and complication of RVM. Where rbenv is a new tool, it is relatively small and its internals are less complex. rbenv uses the same approaches as RVM and is more readable if only by smaller code base which is due to the fact it is a far less mature piece of software and has far less experience accommodating different environments and platforms. It has not been extensively tested on most available operating systems. While RVM continues to press forward with new features on a solid software foundation, rbenv will continue to grow and progress but will continue to ride RVM’s coattails. It’s simple to take an existing piece of open source software and apply hindsight to create a more slim, less feature packed and less tested piece of software. We wish to see rbenv grow and expand into a great piece of software that provides a different solution to ruby environment management so both projects may learn from one another.

There is one additional thing that Is available for RVM which you will not find for rbenv – Jewelery Box – the official OS X RVM GUI. As rbenv claims to be minimalistic tool it does not seam to need any GUI – but as popularity of JB shows there is a need for such tool.

In closing, I would like to mention that we know that RVM grow big and could use some refactoring to make it easier to hack on it and to make the code base more readable and maintainable – we are working on that by planning RVM2 as an SM extension – SM is another project from Wayne E. Seguin worth checking and big enough to cover few articles. We hear our users loud and clear and have big plans for the future of RVM.

linux server memory management

February 27th, 2011 Comments off

It has been long time since last post, but finally something useful shown up, today I want to present simple script for monitoring memory in Linux.

But first happy news: our server is now sucessfully migrated to nginx, no more apache, now maximal memory usage is 20MB per process.

So here is script, it is almost simple, find some processes, and kill them if to much RAM used:

#!/bin/bash

threshold_mb=25
kill_at_mb=$((threshold_mb*5))
memory=$(free -m | awk '{if (FNR==2) print $2}')
threshold=$((threshold_mb*100/memory))
kill_at=$((kill_at_mb*100/memory))
log=/dev/shm/psaux.log
count=$(ps aux | awk -v threshold=$threshold '{if (FNR==1 || $4>=threshold) print}' | tee $log | wc -l)
[ $count -gt 1 ] && echo "Showing processes over ${threshold_mb}MB, killing processes over ${kill_at_mb}MB" && cat $log

cat $log | awk -v kill_at=$kill_at '{if ($4>kill_at) print $2" "$4 }' | while read pid mem;
do
used_mb=$(($(echo $mem | sed 's/\.//')*memory/1000))
# fix rounding problem in awk
if [ $used_mb -gt $kill_at_mb ]; then
kill -9 $pid
echo "pid $pid used ${used_mb}MB - killed"
fi
done
rm -f $log

Most important in this script are first two variables, threshold_mb which is a limit for showing processes (it is rough comparison) and kill_at_mb which is limit for killing processes, by default this limit is 5 times bigger then showing threshold. Cause killing is more important operation additional check for used memory is more strict to be sure, only processes over the limit are killed.

Save it to disk and in crontab:

sudo crontab -e

add the following lines:

MAILTO=<your @email>
* * * * * /root/bin/psaux.sh

That’s all, now add some filter in your mailbox to ignore mails form server – this is all automatic, but you might want to have this for later check if some important processes are missing.

NICZ SOFT Multi language blog hosting

March 3rd, 2009 Comments off

Additionally to already supported english version, our user can choose now to use another laguages, currently it is Polish, but can be easily extended to any nuber of langugaes supported by wordpress.

Anybody interested in having private blog in his native language should use available contact options.

Categories: Hosting, News Tags: , , ,