Why can't I connect to bitcoind on localhost? The initial question asked was as follows, but it turned out to be nothing to do with keypools:


  I had keypool=1000 before. Now I started bitcoind (the daemon version)
  with keypool=10000 option, and it is 2 hours already and bitcoind
  didn't start up yet. I.e. I still get error: couldn't connect to
  server when I try to do bitcoind getbalance.
  
  Its a quite fast machine AMD 64bit 4000+ CPU with 10 GB RAM, how long
  the start-up time can be? And will it be so long every time I start
  the daemon, or only the first time?
  
  Will future start-up times increase in any noticeable way if I keep
  keypool=10000 in comparison with 1000? Or any other performance
  degradation, except this first startup?


Edit: In the end it had nothing to do with keypool=10000. For some unknown reason my local interface was down. I fixed it with:

ifconfig lo up


I killed the bitcoin daemon with kill $PID, started it again and within a minute I could do bitcoind getbalance.
My "Intel(R) Core(TM)2 Duo CPU     T6600  @ 2.20GHz" laptop just took 80 seconds to create 1000 new addresses, so I'm surprised you're seeing over 2 hours for 10 times that.

One thing I noticed is that the address creation is noticeable faster now than I remember it - so perhaps upgrading to a recent version of the client will speed things up for you.

Run "tail -f ~/.bitcoin/debug.log" to see a log of which key number it's currently creating.

Either way, the start up should only be noticeably slower the first time, when the pool is initially created.

Edit: (in response to miernik's comment)

The debug.log output will end with lines like the following while it's populating the keypool:

keypool added key 41, size=41
keypool added key 42, size=42
keypool added key 43, size=43
keypool added key 44, size=44
keypool added key 45, size=45
keypool added key 46, size=46
keypool added key 47, size=47
keypool added key 48, size=48
keypool added key 49, size=49
keypool added key 50, size=50


The stuff you're seeing is what happens while bitcoin is running normally.  It's receiving and responding to messages on the P2P network.  I don't know what to suggest as to why it isn't accepting RPC connections.  Could it be a firewall issue, or some other configuration problem unrelated to the keypool argument?