Aleksandar • Vacić

iOS bits and pieces

RS.GetRows() considered harmful

Most of my professional work is done in ASP. And with ASP I built or helped build lots of different sites, including enterprise-level ones, where web server is constantly hit - like always has 300+ requests waiting with max possible number of requests executing. Over time, I followed what was being considered best practice and implemented these things.

One of those practices, probably the most outspoken is: use [GetRows()]( method of ADODB.Recordset and then work with created 2D array. It is quicker, faster, consumes less memory - more efficient in any way. I could not find a single trace of warning, no side-effects mentioned, nothing.

Thus in the latest project I do, I went all-GetRows. I eliminated all traces of RS.EOF and RS.MoveNext, and built huge amount of code using this technique. Initial testing showed greatly increased performances (3x and more) and it went live.

Soon after, the hellish weeks started.

What no one told you is that using GetRows heavily (and I mean heavily) fragments heap memory. So much, that after some time Oracle OLEDb provider or ADO (have no idea which) starts throwing cannot allocate memory messages with several garbage characters after it. When it will happen depends on how much users are attacking the web site. The more users - the very situation where you need high code speed - the quicker it spends the memory. I guess that after a while it gets into situation where there is no large enough memory block to read recordset into it and/or create an array out of it.

CPU is always close to 100% due to heavy load. Maybe there is no free CPU time at all for memory management…

I’m totally stumped with this and have no idea what to do with it. I spent weeks rearranging the code to minimize the array allocation and only managed to postpone the problem point.

Have anyone built ASP site that gets constantly hit and uses GetRows() or generally uses lots of large arrays? Have anyone encountered this at all?

Moving to .NET is not an option in anything that resembles near future. I’m stuck with this and must solve it somehow; the only option I see now is to return to Recordset processing.

Trip to Tunisia

This week my company, Finsoft Ltd, celebrated its 10th anniversary. For that, all employees (accompanied with either wife, husbands, boyfriends, girlfriend…) traveled to Tunisia for three days.

These days, Belgrade is murky, clouded, depressive city, thus the move to sunny beaches was a great gateaway opportunity. I personally had hellish work weeks before it (and similar would follow) so this short break was really welcome. We stayed in Melia El Mouradi hotel in Yasmine, Hammamet - a tourist resort with huge hotels. Everything is shiny and luxurious and pretty expensive. Since we arrived late at night, there was nothing to see from the bus. Thus I got glimpse of what real Tunisia is like on the way back to the airport. It reminded me a lot to south Serbia which is not very complimenting.

The lovely Mediterranean Sea and wonderful sand beaches are definitely the biggest selling point for Yasmine. This is by far the best beach I have ever been to - although I haven’t been to too many since I prefer mountains over seas. We played beach volleyball, flew the parachute and rode the banana (both driven by motor boats) and generally had a very good time.

Last night we all went to cabaret restaurant Chahrazed (I think that’s the correct spelling). Simple two-part dinner was followed by what most of us thought would be one belly dancer putting (something like) 10-minute show and that’s it. It turns out that its a whole show that would eventually last almost an hour. Frankly, I have no idea how long it lasted. I was so mesmerized by the beautiful girls that I forgot about the dinner, time and everything else. Richly designed and very colourful costumes, greatly rehearsed dancing and beautiful girls (did I already said that?) - completely captivating. When they got up on the tables in the end…let me just tell you that it’s not for the weak hearts.

Sadly, this was not the only thing that followed this dinner. Practically all of us got rather severe stomach problems. I had troubles mere 2-3 hours after the dinner was over, my sister last night (whole two days later). Some got it pretty bad (like fever-high temps), some so and so. But in general, we were all screwed. I’m most sorry that my all-night toilet party robed me completely of the swim & play experience the next day (we headed back in the evening of the next day). I’m still feeling consequences, but it does not hinder (too much) my weekend routine.

Hence - be warned - African food/water is most likely not compatible with us Europeans.

There are other things that I did not like in Tunisia and some that really pissed me off, but I have no wish to write about them now…You see, when I close my eyes I still see this lovely-skinned belly half a meter from my head. And if food poison is the price to pay for this show, I would gladly pay it again.

Rossi rulez

Today’s MotoGP race in Qatar was awesome. Rossi won and he really showed champion-class today, battling with two Hondas of Gibernau and Melandri. Sete (again) made last-lap error under heavy pressure from Melandri who on the other hand had a misfortune of his Honda not being quick enough on the long straight. Two Italians fought wheel to wheel until the very end when Rossi hold off Marko’s attack and stay on track while Melandri barely kept his bike up but managing to finish second, ahead of Nicky Hayden.

Valentino is without the doubt the best driver in the world and what is more important to me - fair, fun and always exciting to watch.

Champion crowned in Brasil

Fernando Alonso is new F1 world champion. With masterful driving in the several first races of the season and with closest rivals having too much reliability problems he succeeded to become the youngest champion ever, at 24 years and almost two months. My sincere congratulations to the man. It is well deserved title for the Spain, who always had drivers in F1.

On the cheerful ;) side of this race, McLaren finally had its long deserved 1-2 finish. Montoya aggressively passed Alonso at the beginning and later Kimi passed him through after Alonso’s first stop (he went first of all). McLarens clearly belong to a class of their own, but it came too late. Too many DNFs, too many problems. They remain my favourite team, never boring to watch. They will most likely win the Constructors title - which is well deserved just the same.

Sidekick of the day: Renault’s mechanic who wore a shirt with “Schumacher who?” written on the back. :)