Subject Re: [IB-Architect] SUPERSERVER_V2
Author Olivier Mascia
Dmitry,

I can't comment on the IB code itself, but more on the useage and some pro
/ cons of those flags. I used them in different projects.

> FILE_FLAG_OVERLAPPED
As you know, used to initiate asynchronous file handling. Requires a lot of
code to be changed to really benefit from it. If the updates consist in
replacing a plain ReadFile by an asynchronous one immediately followed by a
wait for the asynchronous read to complete, no benefit would be gained. But
cleverly using asynchronous I/O may bring huge improvement in Windows NT.
Especially if using the "I/O completion ports" techniques.

> FILE_FLAG_NO_BUFFERING
Also interesting. But not without carefull analysis and design up-front.
This basically shuts down the Windows cache manager for accesses to that
file. There is one BIG condition : I/O must always be of a number of bytes
which are multiple of a "sector" size. That must be queried dynamically,
because can be different from file system to file system. Often what people
do (and that sounds logical), is to use the OS page size (which is of
course such a multiple - no questions asked). In most Windows NT
configurations that is 4K. But there is an API to check that (do not remind
it right now). I think I remember the page size is 8K and not 4K on Alpha
processor versions of NT 4 - not really sure though.
Bypassing Windows cache can be a big benefit or a big hit depending on IB
own caching (which is then the only kind of cache between program code and
data on disk).
The most common use of that flag I have seen is when you want to use
memory-file mapping (mapping all or part of your in memory).

For sure, with the right threading handling (pool of worker threads),
asynchronous I/O and no buffering mixture, you can make I/O scream on NT.
But this is far more from being an easy exercise.

Olivier Mascia

-- On 31/01/2001 16:24 +0300 Dmitry Kuzmenko <dima@...> wrote :

> Hello, All!
>
> My question is related to sources, but I think it is question about FB
> architecture and features.
>
> Reading sources I've found interesting define named
> SUPERSERVER_V2.
> At least in jrd\winnt.c there is a code
>
> P I O _ o p e n (open a database file)
>
> if ((desc = CreateFile (ptr,
> GENERIC_READ | GENERIC_WRITE,
> FILE_SHARE_READ | FILE_SHARE_WRITE,
> NULL,
> OPEN_EXISTING,
> FILE_ATTRIBUTE_NORMAL |
> #ifdef SUPERSERVER_V2
> FILE_FLAG_OVERLAPPED |
> FILE_FLAG_NO_BUFFERING |
> #endif
> FILE_FLAG_RANDOM_ACCESS,
> 0)) == INVALID_HANDLE_VALUE)
>
> these two flags (in SUPERSERVER_V2 ifdef) looks very interesting.
> Does somebody tested performance with this define enabled?
> Will it be set in future FireBird builds for Windows?
> Why this define is not yet enabled? (or it is already?)
>
> p.s. also, who can comment another interesting define -
> ISC_DATABASE_ENCRYPTION?
>
> --
> Dmitry Kuzmenko, Epsylon Technologies.