On 05/07/2012 00:03, James Raftery wrote: > On 4 Jul 2012, at 21:26, Anand Buddhdev <[email protected]> wrote: >> Is there a faster way to determine the size of an update message >> to allow this kind of batching? Ideally I'd like to make an update >> message as close to 64k as possible. > > Use the to_wire() method on each rrset and keep a running total, > taking into account the size of the Update message before you add any > records? Would that be a good enough approximation?
Thanks for this suggestion James. I found that calling the to_wire() method of each message is about as expensive as sending the update, so I don't gain much. I'm now investigating batching over TCP. I want to build a string of the form: <len1> <msg1> <len2> <msg2> and then send it to the DNS server over TCP. I wrote a little loop to take individual update messages, convert them to wire form, calculate their length, pack it, and prepend it to the wire form. I was then able to make a socket connection to the DNS server and just send this multi-message string off. Are there any classes in dnspython for doing this already? I can't seem to find any, or perhaps I am misreading the documentation. For example, if I have update messages u1, u2 and u3, I'd like to be able to do: update_batch = u1 + u2 + u3 dns.query.tcp(update_batch, address) Can this be done easily? Regards, Anand _______________________________________________ dnspython-users mailing list [email protected] http://howl.play-bow.org/mailman/listinfo/dnspython-users
