[freetds] FreeTDS on Core 2 Duo problem

ZIGLIO, Frediano, VF-IT Frediano.Ziglio at vodafone.com
Fri Feb 16 08:50:58 EST 2007


> 
> Hi all,
> 
> I've just come accross a strange behavior of FreeTDS running 
> on Core 2 Duo CPU. I'm using it from PHP. The pages with sql 
> queries were generated much  faster on my older machine than 
> on my brand new Core 2 Duo PC. I've done a little 
> investigation and I found that queries take an unreasonable 
> amount of time. Looking more closely into the matter I found 
> the following strange behavior:
> 
> 1. I've created a script sql-test with the following content:
> 
> <code>
> #!/bin/sh
> for ((i=1; i<100; i++)); do sqsh -U sa -S my_server -D my_db 
> -P my_passwd -i my_query.sql -p; done
> </code>
> 
> It runs the same query repeatedly (100 times) and prints some 
> statistcs (how much time it took).
> 
> 2. While running the sql-test script above, the time a single 
> query takes grows and grows. Sometimes it drops to reasonable 
> time (0.1s) but then it grows upto several seconds.
> 
> 3. But, running the sql-test script on two consoles 
> concurrently, makes each single query complete in reasonable 
> time. As the two sql-test processes take different time, one 
> of them stops earlier then the other. After one of the two 
> sql-test processes stops, the queries from the other sql-test 
> process immediately start to run much slower.
> 
> 4. Moreover, when I run the sql-test script while a PHP page 
> with sql queries is being generated, then the PHP page is 
> generated fast. When I do *not* run the sql-test script while 
> a PHP page is being generated, then the PHP page is generated slowly.
> 
> 5. When I generate two PHP pages with sql queries 
> simultaneously, the pages are generated fast.
> 
> Summary: It is clearly not PHP-related thing, because the 
> problem appears even in SQSH alone. It is clearly also not a 
> SQSH-related thing, because PHP-SQSH is fast and PHP-PHP is 
> fast. Therefore, I think it is a FreeTDS-related problem.
> 
> Is it a bug in FreeTDS? Is it a misconfiguration? Any ideas, 
> solutions?
> 
> Thanks
> 
> Pavel
> 
> FreeTDS 0.64 and 0.63
> SQSH 2.1.4
> OpenSuSE Linux 10.2 x86
> CPU: Core 2 Duo @ 2.4
> RAM: 2GB

Quite strange. When you try to stress db db reply faster while when you
don't use that much db db is slower.

Perhaps it can be a problem related to server configuration. There is an
autoclose flag that force server to close a single database when there
are no activity on db. Perhaps executing queries from 2 console keeps
database open while executing from a single console keeps opening and
closing database.
On mssql2k you can change this flag from sqlem -> database properties ->
tab "Options" (the flag is "Auto Close")

freddy77



More information about the FreeTDS mailing list