From Sinatra/Ruby to Martini/Go  

Just spent a day to migrate from Sinatra/Ruby to Martini/Golang.

The urgent for me to do this is because the node I have is Linode 2G. I found that by using two Sinatra app with alexch/rerun, it consume almost 200mb in background.

That’s not good.

Recently I start to play with data in Aozora and create one search engine based on TF-IDF to the novels. I choose Martini because it has similar syntax with Sinatra.

And I happen to find that, it take so little memory in background.

Normally I don’t care about the memory usage. But during data preparation for tf-idf, the app is always killed by system due to short of memory.

Because I need to generate data from 280000+ words with 13000+ novels. The data structure it created cannot be fit into my little web node. I choose to generate the data in my MBPR and try to save into mongodb.

And even the data saving is time-consuming. So it tells me that I should try to reduce the background memory usage. So I do it today.

I must admit that I thought I need more time. But it turns out that dealing with template(.tmpl) and mgo is not that difficult. Because I already have some experience. And I do remove some less used features.

The experience is quite good that I think I can start to continue to replace other feature written in previous app.

 
25
Kudos
 
25
Kudos

Now read this

Design Pattern

I got one feature request recently in work. This is one command feature. Previously we already have several function to do the work, but we need to utilize those function to support another new command. Because previously functions are... Continue →