public inbox for bitcoindev@googlegroups.com
 help / color / mirror / Atom feed
From: "Rune Kjær Svendsen" <runesvend@gmail•com>
To: Bitcoin Dev <bitcoin-development@lists•sourceforge.net>
Subject: Re: [Bitcoin-development] Implementing batch processing for -blocknotify
Date: Fri, 31 May 2013 14:37:50 +0200	[thread overview]
Message-ID: <CAH2=CKxBX6BcLS+CSKxZstut+uhHPQUY7HnLHSoMjZACgd4v1g@mail.gmail.com> (raw)
In-Reply-To: <CAFHuXuZaSNkUUX8o_k=wSf5MeQ3tAj6yD8DJuLwbyA0C3xRQuQ@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1773 bytes --]

On Fri, May 31, 2013 at 2:10 PM, Michael Hendricks <michael@ndrix•org>wrote:

> On Fri, May 31, 2013 at 5:56 AM, Rune Kjær Svendsen <runesvend@gmail•com>wrote:
>
>> I have an application that wants to keep up with new blocks as they come
>> in. For that I can use the -blocknotify option with bitcoind, which will
>> execute my application for each new block.
>>
>> The problem is that my app isn't necessarily quick enough to finish its
>> work before a new block comes in and the app is executed again.
>>
>
> In a similar circumstance, I changed my -blocknotify script to quickly
> append necessary information to a queue and immediately exit.  A separate
> script runs at all times monitoring this queue for work and performs the
> labor intensive calculations.
>

I've thought about this as well. It just seems somewhat clunky to me. I'd
really prefer having bitcoind put out messages in batches, if it's doable,
that is.

I'd run into a lot of concurrency issues, as far as I can see, where I
can't be sure that the queue isn't written to while, for example, it is
opened by the program that needs to process the queue items.

What if a disk operation takes a long time to finish, and a two queue
operations want to add to the queue simultaneously? This really brings
forward all the horrors of concurrent programming.


On Fri, May 31, 2013 at 2:17 PM, Jeremy Spilman <jeremy@taplink•co> wrote:

> Would it work to just block the bitcoind thread until your process exits?
>

I don't think that's optimal, no. That would slow down synchronization
drastically.

It would be really nimble for bitcoind to be able to synchronize at full
speed, and only send out events when necessary, batching together
previously queued items.

[-- Attachment #2: Type: text/html, Size: 3100 bytes --]

  reply	other threads:[~2013-05-31 12:38 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-31 11:56 Rune Kjær Svendsen
2013-05-31 12:10 ` Michael Hendricks
2013-05-31 12:37   ` Rune Kjær Svendsen [this message]
2013-05-31 19:25     ` Jeff Garzik
2013-05-31 12:54 ` Andy Parkins
2013-05-31 13:05 ` Jeff Garzik
2013-05-31 22:20 ` Chris Double
2013-05-31 23:29   ` Wladimir
2013-05-31 23:47     ` Chris Double
2013-06-01 13:12       ` Rune Kjær Svendsen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAH2=CKxBX6BcLS+CSKxZstut+uhHPQUY7HnLHSoMjZACgd4v1g@mail.gmail.com' \
    --to=runesvend@gmail$(echo .)com \
    --cc=bitcoin-development@lists$(echo .)sourceforge.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox