Optimizing performances when using the API

Post Reply
tony.malandain
Posts: 57
Joined: Sat Mar 27, 2004 6:39 pm

Optimizing performances when using the API

Post by tony.malandain »

Hi,

We've written a client using the Texis API. It works great and delivers results fast during normal operation, but the first query is always sluggish as it needs to connect to the DB and (I think) load the index in memory.
Is there anything I can do to maintain all the indexes in memory all the time?
Also, is there a timeout on the connection created by the openserver function?

Thanks,
/Tony.
User avatar
John
Site Admin
Posts: 2622
Joined: Mon Apr 24, 2000 3:18 pm
Location: Cleveland, OH
Contact:

Optimizing performances when using the API

Post by John »

There isn't a timeout. Texis relies on the operating system to cache the indexes in memory, so you can have a process that periodically sends representative queries to keep the cache warmed up.

There isn't a timeout on the connection.
John Turnbull
Thunderstone Software
tony.malandain
Posts: 57
Joined: Sat Mar 27, 2004 6:39 pm

Optimizing performances when using the API

Post by tony.malandain »

Could you elaborate a bit more:
what program is managing the indices?
For instance, if I start a new instance of a program every time I need to perform a query, does it reload the indices every time or is there a background program that keeps it in memory for me?
If I have multiple instances of that same program running simultaneously, do they share the same index in memory?
User avatar
John
Site Admin
Posts: 2622
Joined: Mon Apr 24, 2000 3:18 pm
Location: Cleveland, OH
Contact:

Optimizing performances when using the API

Post by John »

Each program will try to reload the indexes. If the
operating system already has the data in memory (disk
cache) it will not need to access the disk. Once read
from disk the OS will keep it until it needs the memory
for something else.

If two programs are running simultaneously they may share the same copy of the index in memory which will keep overall memory usage lower.
John Turnbull
Thunderstone Software
User avatar
mark
Site Admin
Posts: 5519
Joined: Tue Apr 25, 2000 6:56 pm

Optimizing performances when using the API

Post by mark »

If you're using NCGDIRECT your program is the one accessing the tables and indices. Otherwise texisd is accessing them. Multiple instances of either do not share, though the OS file caching will benefit all processes using the same files. Stopping and starting your app will cause the database to be closed and reopened. Subsequent opens will benefit from OS file cache.
tony.malandain
Posts: 57
Joined: Sat Mar 27, 2004 6:39 pm

Optimizing performances when using the API

Post by tony.malandain »

Ok, I understand better how it works now.

John, just to make things clear: when you say that the 2 instances of the program may share the same copy of the index, you mean the program have to explicitly allow that.
The index is a piece of data for the program, so the OS is never going to share it between instances unless the program made the request explicitly. Is this possible with the Texis API?

WRT the OS caching: it is efficient for small pieces of information but an index can be several hundred of MB. Surely there has to be a better way to keep it in memory and share it between the programs running the queries no?

I have about 4GB of memory on the server and I want to dedicate most of it to the index. Any recommendation?
User avatar
John
Site Admin
Posts: 2622
Joined: Mon Apr 24, 2000 3:18 pm
Location: Cleveland, OH
Contact:

Optimizing performances when using the API

Post by John »

The size of the data is not important as far as OS caching goes. Texis will automatically share data between processes if possible. The memory will tend to automatically contain those portions of the index and table that are most frequently used.
John Turnbull
Thunderstone Software
Post Reply