From: Brian W. <bwe...@xb...> - 2006-03-27 18:34:20
|
On Mon, 27 Mar 2006, Anders Kristensen wrote: > I have some questions on how the asynchronous interface of dnsjava works. All of the asynchronous code should be replaced soon with a much better interface, but I'll answer the questions based both the current (a) and in-progress code (b) > 1. Are upcalls performed in the same thread(s) that read data from sockets? (a) Each query creates a new thread, which performs both the resolution and the upcall. (b) A different thread. > 2. If the answer to question 1 is yes, will dnsjava become unresponsive if an > application performs a blocking action (unrelated to DNS) in a dnsjava > upcall? (a) No, as it's a separate thread. (b) Not completely sure yet. > 3. If the answer to question 1 is no, that is, if dnsjava has a mechanism for > delivering responses in threads that are not the ones used for reading data > from sockets, what is this mechanism? (b) A new thread will be spawned to return the response, or possibly the response will be queued. > 4. Will dnsjava ever use TCP for outgoing (async) requests? If so, will > dnsjava write to the TCP socket in the thread that calls Resolver.sendAsync > and if so, is this a blocking call? (a) and (b) TCP will never cause async requests to block anything other than threads watching sockets. > As you can hear I'm worried about various failure scenarios that are probably > not typical but which we have to protect ourselves against nonetheless in the > application we're building. > > Thanks for any light you can shed on this subject. The main problem with the current code is that one thread per async query doesn't scale well. The new code should be a lot better once it's integrated, but I'm way behind on doing that. Brian |