Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / Databases / January 2008

Tip: Looking for answers? Try searching our database.

cached Betriebssystem Results?

Thread view: 
runic - 11 Jan 2008 09:03 GMT
Hallo Gruppe,

ich mache gerade Performancetests für SELECTs auf einer HSQLDB-Tabelle
per JDBC. Die Tabelle ist nicht im Speicher, sondern als Datei auf der
Platte.

Natürlich würde ich die Messungen gerne wiederholbar machen, das
Problem
ist nur, dass der "erste" SELECT z.B. knapp eine Minute dauert,
wiederhole
ich denselben SELECT, benötigt der nur noch z.B. drei Sekunden.
Offensichtlich
wird irgendwo etwas gecached.

Was nur irritierend ist: ich mache den SELECT einzeln in einem JUnit-
Testcase,
in dem am Anfang die Connection zur DB gemacht wird und nach dem Test
wieder geschlossen wird. Also kann HSQLDB das Result doch nicht
cachen,
oder? In der Doku finde ich auch nichts entsprechendes.

Sollte WinXP etwa, auch wenn die Applikation zwischendurch beendet
ist,
Results speichern? Ein ähnliches Phänomen hatte ich mal beobachtet
bei PostgreSQL und Linux, hatte damals aber keine Veranlassung, mich
weiter darum zu kümmern.

Jetzt würde ich dieses Phänomen aber gerne "ausschalten", um
wiederholbare
Benchmark-Tests machen zu können. Ich wäre also für Hinweise in dieser
Richtung sehr dankbar.

Viele Grüße, Detlef
runic - 11 Jan 2008 12:09 GMT
Hello and sorry,

in an english group i should write not in german,
just wondering why i get no answer ;-(

My Question is, where Results of a SELECT (HSQLDB/JDBC)
are cached and how i can "switch off" the caching.

I called a SELECT in a JUnit Task which first open a
connection to DB, do the SELECT and close the connection.
The program stops.

When I started the program twice, the duration of first
run is e.g. a minute, second run takes 3 seconds. But,
because the program doesn't run during 2 calls, where
are the results cached? Has WinXP its finger in the pie?

And second, how can i switch off the caching? I want to
use the duration of certain SELECTs as a "Benchmark"
to compare one SELECT with another. But cached are
falsified results.

Can you please give me a hint, who is caching (i think
not HSQLDB?) and how i can avoid it?

TIA, Det
Roedy Green - 11 Jan 2008 21:13 GMT
>Can you please give me a hint, who is caching (i think
>not HSQLDB?) and how i can avoid it?

The database of course caches.  I doubt there is any way to turn that
off.  The JDBC driver might also.   It might be more amenable to
instruction. Check out the JDBC spec.

See http://mindprod.com/jgloss/jdbc.html
Signature

Roedy Green, Canadian Mind Products
The Java Glossary, http://mindprod.com

joeNOSPAM@BEA.com - 12 Jan 2008 15:55 GMT
> Hello and sorry,
>
[quoted text clipped - 22 lines]
>
> TIA, Det

Roedy hit the point. This has nothing to do with your application
or the OS. If you owned a shop and every saturday, an old lady
came in wanting to buy 1,000 brooms. You'd give her the few you had
on hand, and maybe order the rest and get it to her ASAP, but after
2 weeks like this, you'd probably start every saturday with 1,000
brooms in your shop, and the transaction would go a lot quicker.
  The DBMS has more data than can fit in semiconductor memory,
so it keeps whatever's been needed recently until it is forced to
clear it out to make room for something else.
  If you want to normalize your test, you must ensure the DBMS is
always in the same state to start. You can do this by either
booting the DBMS fresh for the test, or pre-running your test before
officially measuring, or running some huge irrelevant query to
pre-fill the DBMS cache with data you don't need.
Joe Weinstein at BEA Systems
runic - 14 Jan 2008 14:23 GMT
Hello Joe, thanks to you and Roedy,

thank you for your answers. It couldn't be JDBC, because the
JUnit Task is "off" during between to runs, the Library with
JDBC Driver is not in use. I could leave eclipse and start
it again, running the JUnit Task (with the SELECT) again,
this tasks duration is again lesser than after starting the
machine and run the Test for first.

> Roedy hit the point. This has nothing to do with your application
> or the OS. If you owned a shop and every saturday, an old lady

Nice Example with an old Lady, buying brooms. I get it ;-)

But the answer to my first question "who caches", would be
"the Operating system". And to the second part, "where can
i disable the cache", the answer have to be: "you can't
without admin rights".

Okay, Windows have a File Cache and what I sighted was the behaviour,
listed on http://www.mckoi.com/database/maillist/msg00502.html
where the poster get the same characteristics even after reboot,
first run takes more time than following.

Unfortunately I have no Admin Rights to clear the File Cache, so
I have to think about making dummy selection between duration tests,
as you supposed as third opportunity, Joe.

Thanks again, Detlef


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.