table 4: read() call
int close(int fildes) {
static int(*fptr)() = 0;
step c1 if (fptr == 0) {
fptr = (int (*)())dlsym(rtld_next, "close");
if (fptr == null) {
fprintf(stderr, "dlopen: %s \n", dlerror());
return 0;
}
}
step c2 if (fildes == k_bm_fd) {
return 0;
}
step c3 return ((*fptr)(fildes)); }
|
table 5: close() call
7. performance improvement
the performance improvement comes from not executing the system calls. the multiple instances of open(),fcntl(),lseek(), read(), and close() to read the oraus.msb messages are transformed to user-level calls. also, the i/o operation becomes a simple memory-to-memory transfer.
to measure the performance gains, a test program mimicking an oracle client's behavior was developed. the test program performs open(),lseek(), read(), and close() calls on the oraus.msb file 50,000 times.
the test program showed a gain of about 1000%. however, in a real oracle client application, this might translate to about a 2 percent-to-15 percent gain in performance.
7.1 without ld_preload and cache_oraus.so
|
table 6: ptime test.sh
7.2 with ld_preload and cache_oraus.so
|