Speed on Rails

November 16, 2005 | Filed by Marius under: web dev, rails

Wow, long time no post :) I was busy at work and had taken a pause in following all the hypes _du jour_ on the web.

Meantime, I managed to improve my rails photo album (see mapopescu.com index page). After a couple of tries and (finally) a successfull installation of fastcgi on my Win XP machine, I decided to focus on the code and speed of the application rather on its deployment.

So I got back on using webbrick (the default webserver installed by rails). It is single threaded and more suitable for development, but still…

For the code, at first it was kind of weird, I had a feeling of panick because the Ruby code was still a stranger to me. Even if I advanced on full speed (using my “Agile Ruby on Rails programming” guide) , the code was just too easy and it didn’t “felt” right. So I bought the “Programming Ruby” book from PragmaticProgrammers.com. Now it starts to lighten, I begin to understand some wierd things (like blocks) etc. After a week or so of studying, I began to see my code was not so clean and dandy, so I splitted some classes, added some code from the controller to the model. I still don’t understand exactly how a model “finds” another class, which is not in it’s controller, neither in its appplication controller. I guess it will come in time. I must be too used to the “unit” view of Delphi … oh well :)

Then I improved my RMagick code, put the thumbnails in the database (this was a great improvement on the overall speed). Today I found another speed hack, I added a secondary index on some photos fields which are searched very often and mainly before serving a page to the client. Another big push (and obvious too, doh!).

Now I am much more confident in Rails, the whole deployment adventures kind of discouraged me. There are some things not very clear. I tried to add caching on the images being sent to the client, using caches_page, and I got a lot of .html pages looking weird (I guess they contained the images). The problem was that they weren’t served so well to the clients … I had crashes, plenty of errors on the development.log etc. I was still using fastcgi, don’t know if this can be related. So I rolled back this change for now.

For the whole deployment adventures I think a smoother path for the newbies (on ruby, rails, but apache too) it would be great to have some kind of server ready to deploy, multi threaded if possible, I don’t know, kinf of webbrick but serving more ports, or a windows app (service?) calling multiple cgi instances, or the SCGI for rails implementation … Something IS needed.

20th century sofware

November 3, 2005 | Filed by Marius under: general, desktop software

Today I want to share with you my recent weird software experiences. It’s not about bugs or crashes or anything. It is about things that should work and they just don’t.

Recently I downloaded the latest Adobe Acrobat Reader 7. It is beautiful, the speed is awesome, specially for the web (which was a pain in the ass before). So I went home and tried to do the same. As in installing the Acrobat Reader 7.

The download went fine. Instead of having a “AcrobatReader_setup.exe” I had a download manager. Weird. OK, they know better! I launched the “Download manager”. And then I had this dialog window, with a download progress bar and some buttons/options (minimize to tray, download only when idle etc).
So I say to myself: “Oh, yes, now I get it. They are kind to us and protecting us, and taking care of us”. Adobe will look out and don’t stand in your way. Cool.

After a couple of seconds (I have a 1 meg DSL line) nothing happened. OK, they know better, let’s put it in the tray, it’ll woke up soon. And I forgot about it for an half an hour or so. And then I clicked it to see the progression. Empty progress bar, the useless and silly buttons … Weird.

After a couple of hours digging the web to find the solution, a light came upon me and said to me: “try in Internet Explorer!” Maybe it was me using my beloved Firefox. So I opened the IE and typed the URL etc. And IE asks me: “Do you want to go online now?”. A thunder comes from nowhere and hits me right there! Quick: open IE menu, File, Offline, uncheck offline option, open Adobe Download manager … and relax … it starts downloading …

Man, I was almost crying … the Adobe Acrobat Reader Download Manager was waiting for IE to go online … wwwwwwwwrrrrraaaaaaggghhhhhhhhhh (= cry of anger).

I said to myself, what a pitty, a beautiful and usefull software hidden behind a useless manager.
And forgot about it.

And today, another example hits me: this time no harm done. It’s only silly.
I have setup in my Norton Antivirus to go check my system at a certain hour a certain day. Sunday we changed from summer time to winter time. And Norton it seems to use the Windows’ task scheduler. Which is fine. BUT NOT WHEN I TOLD IT TO OPEN AT LUNCH TIME AND IT OPENS AN HOUR SOONER! Because, you see, the system has updated it’s internal time, now 1pm = noon. But the scheduler application have not! So 1pm before the hour change has become noon in the scheduler too!
If I add a task at 1pm, why on Earth would I want it to be done at noon after the 1st November ???

PS Wow, I feel much better now, peaceful and relaxed.

      


The content of this blog is subject of a Creative Commons License.

Get free blog up and running in minutes with Blogsome
Theme designed by Viewfinder Design