Hey,
I am not shure, if I got you right:
> ... kaio do now support socket operation, ....
kaio is kernel asynchronous i/o which
operates on raw devices ("slices of your harddisk"
or lofi devices) e.g. /dev/rdsk/c0t0d0s6.
When there is no kaio available (e.g. you didn't
start your programm as root), then it automatically
falls back to use aio (whis is "user-land-library asynch. i/o).
What has this to do with socket servers?
> ... high performance multi connection (above 1k) socket server on solaris ...
If you would have Solaris Next, you could simply
use SIGEV_THREAD notification framework (in fact being an add on to
the Event Ports framework) to set up and let the "system" handle a thread pool
for e.g. asynchronous, message queue or timer "Events" by itself
(man aio_read/aio_write/lio_listio/mq_notify/timer_create) instead of
you wasting your brain in programming the x-th high performance
multi-threading worker-modell.
Here a code-sniplet of its usage, if you want
to have high-performance asynch. I/O:
aiocb_t *aiocb[NREQ];
aiocb[i] = (struct aiocb *) calloc(1,
sizeof (struct aiocb));
aiocb[i]->aio_fildes = fd; <---- Your device!
aiocb[i]->aio_buf = (char *)malloc(BSIZE);
aiocb[i]->aio_nbytes = BSIZE;
aiocb[i]->aio_offset = 512L;
aiocb[i]->aio_reqprio = 0;
/*
* If you don't want SIGEV_THREAD notification, you should
* comment these lines
*/
aiocb[i]->aio_sigevent.sigev_notify = SIGEV_THREAD;
aiocb[i]->aio_sigevent.sigev_notify_function =
aio_notification1; <--- Here is your
Notification handling function
aiocb[i]->aio_sigevent.sigev_value.sival_int = i;
<--- some param for that func.
aiocb[i]->aio_sigevent.sigev_notify_attributes = NULL;
rc = aio_read(aiocb[i]); <--- Do (k)aio depending on
device
If you are using e.g. Sol. 10, then, you could
use Event Ports (as I said above, Event Ports is the basis of SIGEV_THRED),
but then all "event handling" code has to be programmed by yourself,
while in the above example, simply write the "signal handling
function aio_notification1() (please make a a thread-safe function
e.g. calling only other thread-safe functions e.g. gmtime_r() and so on)
and you are done. Nice isn't it?
And by the way: This is a POSIX feature that runs without
modifications on every POSIX compliant box (e.g. Linux)
while our Event Ports is a Solaris only feature.
Best regards,
Michael
AD wrote:
Hi,
I am a solaris newbie and want to develop a high performance multi connection (above
1k) socket server on solaris. At beginning I found a topic in docs.sun.com, it tought
me that I could use aio and thread pool to finish my work. Then I wrote the basic
thread/aio code of my server, but when I read the book <solaris internals> , it
told me that the solaris kio support only raw device, the book also told me how to
test whether the kaio is supported or not, I used truss to trace my code and found
the follow result
kaio(AIOREAD, 4, 0x0041EF24, 4, 0x0041EF1000000000) Err#81 EBADFD
I think it means that solaris kaio do not support socket. Could anybody tell me is that correct?
If solaris kaio does not support socket, it may mean that solaris will create
many user thread to simulate asynchronous operations. Is there any high
performance socket io model for my multi connections socket server?
This message posted from opensolaris.org
_______________________________________________
perf-discuss mailing list
perf-discuss@opensolaris.org
--
Michael Schulte [EMAIL PROTECTED]
OpenSolaris Kernel Development http://opensolaris.org/
_______________________________________________
perf-discuss mailing list
perf-discuss@opensolaris.org