Wrote my first custom mongrel handler and it is ugly. I have not used ERB, eruby or erubis yet to generate HTML.
Benchmark results for mongrel handler
Transactions: 5000 hits
*Elapsed time: 54.55 secs
*Data transferred: 2.90 MB
*Response time: 0.45 secs
Transaction rate: 91.66 trans/sec
*Throughput: 0.05 MB/sec
*Longest transaction: 1.63
*Shortest transaction: 0.00
A similar app on rails was made and here are the benchmark figures
Transactions: 5000 hits
*Elapsed time: 195.34 secs
*Data transferred: 3.39 MB
*Response time: 3.29 secs
**Transaction rate: 25.60 trans/sec
*Throughput: 0.02 MB/sec
*Longest transaction: 7.63
*Shortest transaction: 0.01
There is almost a 4 fold jump in transaction rate and therefore Mongrel handler can be used to handle pages which have very high hit counts
However using plain vanilla mongrel handlers to write pages is very difficult as it does not automagically 'renders' html pages.
Thursday, July 12, 2007
Monday, July 09, 2007
Ruby
After 3 months with Ruby, I think it's a great language. It may not be as fast as C or Perl but it is very developer-friendly. It's 100% object oriented. That means everything is an object and hence everyobject can be manipulated by some very useful set of methods that are provided with the language
So you can say something like this
12.next => 13
12.remainder(5) => 2
It also supports some of the very powerful features of Lisp(Greatest language ever !) like unnamed functions, blocks, iterators etc
"A quick brown fox jumped over a lazy dog".downcase!.split(//).sort.uniq.each {|char| print char+" "}
gives
a b c d e f g i j k l m n o p q r u v w x y z
Being 100% OOPs is one of the strongest features of this language
1.upto(10){|i| puts "9 X #{i} = #{9*i}"}
will give you table of 9
9 X 1 = 9
9 X 2 = 18
9 X 3 = 27
9 X 4 = 36
9 X 5 = 45
9 X 6 = 54
9 X 7 = 63
9 X 8 = 72
9 X 9 = 81
9 X 10 = 90
It offers "minimum surprise" to a newbie and the code is very easy to read.
Though there are some downsides also as it is interpreted only language and can be slow. But come Christmas 2007 a new ruby version is being released which hopes to solve this problem to some extent.
So you can say something like this
12.next => 13
12.remainder(5) => 2
It also supports some of the very powerful features of Lisp(Greatest language ever !) like unnamed functions, blocks, iterators etc
"A quick brown fox jumped over a lazy dog".downcase!.split(//).sort.uniq.each {|char| print char+" "}
gives
a b c d e f g i j k l m n o p q r u v w x y z
Being 100% OOPs is one of the strongest features of this language
1.upto(10){|i| puts "9 X #{i} = #{9*i}"}
will give you table of 9
9 X 1 = 9
9 X 2 = 18
9 X 3 = 27
9 X 4 = 36
9 X 5 = 45
9 X 6 = 54
9 X 7 = 63
9 X 8 = 72
9 X 9 = 81
9 X 10 = 90
It offers "minimum surprise" to a newbie and the code is very easy to read.
Though there are some downsides also as it is interpreted only language and can be slow. But come Christmas 2007 a new ruby version is being released which hopes to solve this problem to some extent.
Saturday, June 23, 2007
Konqueror: A better browser
I just ran a css compatibility test on konqueror and firefox and amazingly
konqueror passed all the tests while firefox flunked many!
Konqueror: From the 43 selectors 43 have passed, 0 are buggy and 0 are unsupported (Passed 578 out of 578 tests)
You can test you own browser at http://www.css3.info/selectors-test/test.html
Hmm... Now I remember somebody told me a few years ago that Konqueror is a better browser...Okay...point noted
konqueror passed all the tests while firefox flunked many!
Firefox: From the 43 selectors 26 have passed, 10 are buggy and 7 are unsupported (Passed 357 out of 578 tests)
Konqueror: From the 43 selectors 43 have passed, 0 are buggy and 0 are unsupported (Passed 578 out of 578 tests)
You can test you own browser at http://www.css3.info/selectors-test/test.html
Hmm... Now I remember somebody told me a few years ago that Konqueror is a better browser...Okay...point noted
Tuesday, June 05, 2007
Rails Roko
I never follow any cult and nor do I despise any "particular" OS because every other geek in town does. But if I had to follow one, I would have joined a "rails-roko" cult :P. People argue that rails is in the same stage as Php was 9 years ago. Fine! I agree that things take time to stabilize but then you should not publicize it as the next big thing after bread!
Rails, the idea, is great. Web programming is mostly CRUD and having a framework that makes it all so easy should be encouraged. But then encouraging and supporting it one thing and marketing it as if it is enterprise ready is quite another.
Rails has a number of show stoppers like mongrels wake up issue, performance issue, freedom issues!.
I have tried to deploy a third party rails application in a production environment with "minor changes". These minor changes turned out to be monstrous. Switching to a only-cookie-based-system (to make the system scalable) turned out to be a nightmare. Now flash notices and errors don't work as they use sessions and I have completely disabled them. Running a mongrel cluster behind a apache frontend is also a big nightmare. Mongrels die (or go into deep sleep) overnight and wake up after a long time (~10 mins) after a page is requested. Per mongrel transaction count is also low.
It is very easy to do stuff in rails which result in a huge number of database queries like a 'forum.topic.post.last.created_at' in the view against each forum makes life miserable for the rails app as it first hits a method_missing in ruby interpreter and then rails tries to generate a function out of it after looking at all class declarations! and that is slow like anything. I switched it off and found that requests/sec count went up from 6-7 req/sec to a mind boggling 70-100 req/sec!
So all the marketing gimmicks are not going to work unless the stuff actually works!
More rails cribbing later
Rails, the idea, is great. Web programming is mostly CRUD and having a framework that makes it all so easy should be encouraged. But then encouraging and supporting it one thing and marketing it as if it is enterprise ready is quite another.
Rails has a number of show stoppers like mongrels wake up issue, performance issue, freedom issues!.
I have tried to deploy a third party rails application in a production environment with "minor changes". These minor changes turned out to be monstrous. Switching to a only-cookie-based-system (to make the system scalable) turned out to be a nightmare. Now flash notices and errors don't work as they use sessions and I have completely disabled them. Running a mongrel cluster behind a apache frontend is also a big nightmare. Mongrels die (or go into deep sleep) overnight and wake up after a long time (~10 mins) after a page is requested. Per mongrel transaction count is also low.
It is very easy to do stuff in rails which result in a huge number of database queries like a 'forum.topic.post.last.created_at' in the view against each forum makes life miserable for the rails app as it first hits a method_missing in ruby interpreter and then rails tries to generate a function out of it after looking at all class declarations! and that is slow like anything. I switched it off and found that requests/sec count went up from 6-7 req/sec to a mind boggling 70-100 req/sec!
So all the marketing gimmicks are not going to work unless the stuff actually works!
More rails cribbing later
Thursday, May 24, 2007
A few thoughts about Ruby on Rails
1. Starting is fun and easy. A few configurations, sqls and commands and "almost" everything you need is done.
2. First road block comes when you create views which query multiple tables in one go.
3. Life becomes easy again when you have to modify designs and templates. Page templates resides in different folder so html headache is minimum
4. You really have to bang your head in the wall if you try to integrate your app in a portal with an already-present-cookie-based login system!
5. Never ever try to do #4 with a thrid party app.
6. Rails somehow seems very immature with the way DHH changes stuff. Apps created in rails 1.1 doesn't work with rails 1.2. Even ruby versions and "optional" gems create problem and to add to the misery these errors are either cryptic or so insanely-damn-fucking stupid that you won't ever realize that it's a version clash. (A "wrong number of argument "... error surfaced because I had a older RedCloth gem and it was a discovery almost by accident when I out of sheer frustration uninstalled everything and installed everything again)
7. Rails has weird gotcha and it stems from the fact that it is cryptic. An innocent looking column name in a table would give you so much pain that you feel like banging your head against your monitor. Don't do that becuase first it can be dangerous and second it's not your fault. Check out these links
http://wiki.rubyonrails.org/rails/pages/Gotcha
http://blogs.thewehners.net/josh/view/178
8. Performance of a "default" app sucks big time. A lot of tweaking is necessary to make it fast enough to be barely usable.
More on rails bitching later
2. First road block comes when you create views which query multiple tables in one go.
3. Life becomes easy again when you have to modify designs and templates. Page templates resides in different folder so html headache is minimum
4. You really have to bang your head in the wall if you try to integrate your app in a portal with an already-present-cookie-based login system!
5. Never ever try to do #4 with a thrid party app.
6. Rails somehow seems very immature with the way DHH changes stuff. Apps created in rails 1.1 doesn't work with rails 1.2. Even ruby versions and "optional" gems create problem and to add to the misery these errors are either cryptic or so insanely-damn-fucking stupid that you won't ever realize that it's a version clash. (A "wrong number of argument "... error surfaced because I had a older RedCloth gem and it was a discovery almost by accident when I out of sheer frustration uninstalled everything and installed everything again)
7. Rails has weird gotcha and it stems from the fact that it is cryptic. An innocent looking column name in a table would give you so much pain that you feel like banging your head against your monitor. Don't do that becuase first it can be dangerous and second it's not your fault. Check out these links
http://wiki.rubyonrails.org/rails/pages/Gotcha
http://blogs.thewehners.net/josh/view/178
8. Performance of a "default" app sucks big time. A lot of tweaking is necessary to make it fast enough to be barely usable.
More on rails bitching later
Thursday, May 03, 2007
Business Idea #1
Okie here goes my first one:
1. General Knowledge on the move
Wikipedia is a free source of knowledge but this knowledge base is restricted to web. What if there be a tool which summarizes those articles (possibly divding it into multiple pieces and shorten it) and makes it available over mobile phones. For instance you want to look up "Lake saimaa" (It is the largest lake in finland and is very beautiful), it picks up the relevant article from wiki and sends back the user a sumamry.
In this case since the article size itself is small (character count 1025) so summarizing it (making it 320 character long) won't be a big issue as such. Some of the popular "sms" shortcut transforms can be used. But what if somebody searches for say "India". Then the summarizing code has to be more intelligent to take the article and ascertain which are the important parts of this particular article (in this case geography, political system, economics, population, military, culture etc). Then it should return say about 200 character long article on India and list it's population, GDP, Average expectancy of life etc and say "make more relevant search by saying ex. India GDP" etc.
This way people are intrigued to send more smses to search server for more content which would in turn result in more revenue.
Now what if somebody sends a query about some recent happening or some obscure topic which wikipedia has no knowledge about. Then we land in a soup. Wikipedia alone cannot cater to all the knowledge "needs". We will need more content, news, articles and such.
Okay then so much for mobile content.
1. General Knowledge on the move
Wikipedia is a free source of knowledge but this knowledge base is restricted to web. What if there be a tool which summarizes those articles (possibly divding it into multiple pieces and shorten it) and makes it available over mobile phones. For instance you want to look up "Lake saimaa" (It is the largest lake in finland and is very beautiful), it picks up the relevant article from wiki and sends back the user a sumamry.
In this case since the article size itself is small (character count 1025) so summarizing it (making it 320 character long) won't be a big issue as such. Some of the popular "sms" shortcut transforms can be used. But what if somebody searches for say "India". Then the summarizing code has to be more intelligent to take the article and ascertain which are the important parts of this particular article (in this case geography, political system, economics, population, military, culture etc). Then it should return say about 200 character long article on India and list it's population, GDP, Average expectancy of life etc and say "make more relevant search by saying ex. India GDP" etc.
This way people are intrigued to send more smses to search server for more content which would in turn result in more revenue.
Now what if somebody sends a query about some recent happening or some obscure topic which wikipedia has no knowledge about. Then we land in a soup. Wikipedia alone cannot cater to all the knowledge "needs". We will need more content, news, articles and such.
Okay then so much for mobile content.
Saturday, April 14, 2007
Wednesday, March 14, 2007
Catching Up
A lot has happened in the tech world and in my world. I have kinda drifted away from this blog due to extremely stupid and irritating web filtering at work. One cannot access even blogs!! There is this really irritating filter called websense. It categorizes all the websites into various categories and the admin can blog them...category by category! Shopping, tasteless!, dating and personal , GMAIL, webmail, proxy avoidance, Message boards and clubs, Lifestyle and society! and Sports!! are some of the categories that are banned there. Well not for very long ...I have resigned and will be joining a travel search firm.
It is amazingly stupid that some people think that you can actually make people work in a organization by limiting access to the net and setting entry and exit restrictions! Maybe in a mill or something but where you have people working on large projects and most of the work is accomplished by taking a personal interest, a ban on things junta does in leisure time is suicidal. No wonder out of four people in my cubicle 3 have already put in their papers.
I think the new India and new Indians are a very different from the old India that was there 20-30 years ago. Censoring tactics like china is not going to work in a free country like India. Some may argue that censorship does exists in movies. Well hindi movies anyways don't have a lot of free speech and change the world kind of stuff. Moreover there is no choice. Job scene on the other hand is a very different ball game altogether!
Tech world in the next post.
It is amazingly stupid that some people think that you can actually make people work in a organization by limiting access to the net and setting entry and exit restrictions! Maybe in a mill or something but where you have people working on large projects and most of the work is accomplished by taking a personal interest, a ban on things junta does in leisure time is suicidal. No wonder out of four people in my cubicle 3 have already put in their papers.
I think the new India and new Indians are a very different from the old India that was there 20-30 years ago. Censoring tactics like china is not going to work in a free country like India. Some may argue that censorship does exists in movies. Well hindi movies anyways don't have a lot of free speech and change the world kind of stuff. Moreover there is no choice. Job scene on the other hand is a very different ball game altogether!
Tech world in the next post.
Monday, January 29, 2007
Indian Social Networking -- Part 2
Sometimes this whole idea of Indian Social Networking reminds me of 1999. A disaster prone, completely unfeasible idea of selling a service on internet (free substitutes of which are already available). Indian public just won't buy anything online. But then whats the harm in trying (if money is not from your pocket). Maybe they can sell cakes, cards, t-shirts, CDs, DVDs, flowers etc. Then they can also act as job search websites! ..Imagine naukri turning into a social networking website!!!
Subscribe to:
Posts (Atom)