You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@couchdb.apache.org by Chris Stockton <ch...@gmail.com> on 2010/07/16 01:18:54 UTC

Trying to get 5000+ databases replicating, no success thus far.

Hello,

I have gone through a good amount of research and effort trying to get
a large amount of databases replicating, with a good amount of help
from this list. I have hit a road block and am unable to get more then
2000+ databases replicating.

Something tells me [1] might be part of my issue. I have downloaded
and installed couchdb-0.11.1, I made sure that patch was present in
the source. I included the limits in the INI file but they do not seem
to be respected, or I am hitting a different kind of limit. Here [2]
is the errors that couch starts throwing when I get to roughly 2048~
(the default number of allowed connections).

These exist in my couchdb init script:
ulimit -n 1000000
export ERL_MAX_PORTS=100000
export ERL_MAX_ETS_TABLES=10000

This is the init script start command:
daemon --user couchdb "$exec -b -p
/<dir>/couchdb-0.11.1-test/couch.pid -a
/<dir>/couchdb-0.11.1-test/local.ini +P 65536"

I am certain the following local.ini is being parsed, as I run on a
non-standard port, in addition I am certain the path is correct:
[couchdb]
os_process_timeout=60000
max_dbs_open = 100000

[httpd]
max_connections = 9000
port = 59840
bind_address = 0.0.0.0

At this point I am looking for some expertise from other people who
have dealt with large-scale replication.

Kind Regards,

-Chris

[1] https://issues.apache.org/jira/browse/COUCHDB-705
[2] ---

[Thu, 15 Jul 2010 23:03:53 GMT] [error] [emulator] ** Too many db tables **



[Thu, 15 Jul 2010 23:03:53 GMT] [error] [<0.21959.3>] {error_report,<0.28.0>,
    {<0.21959.3>,crash_report,
     [[{pid,<0.21959.3>},
       {registered_name,[]},
       {error_info,
           {exit,
               {system_limit,
                   [{ets,new,[replication_stats,[set,private]]},
                    {couch_rep,do_init,1},
                    {couch_rep,init,1},
                    {gen_server,init_it,6},
                    {proc_lib,init_p_do_apply,3}]},
               [{gen_server,init_it,6},{proc_lib,init_p_do_apply,3}]}},
       {initial_call,{couch_rep,init,['Argument__1']}},
       {ancestors,
           [couch_rep_sup,couch_primary_services,couch_server_sup,<0.29.0>]},
       {messages,[]},
       {links,[<0.22081.3>,<0.22182.3>,<0.22268.3>,<0.22166.3>,<0.78.0>]},
       {dictionary,[]},
       {trap_exit,true},
       {status,running},
       {heap_size,2584},
       {stack_size,23},
       {reductions,2097}],
      [{neighbour,
           [{pid,<0.22268.3>},
            {registered_name,[]},
            {initial_call,{erlang,apply,2}},
            {current_function,{erlang,apply,2}},
            {ancestors,[]},
            {messages,[]},
            {links,[<0.21959.3>]},
            {dictionary,[]},
            {trap_exit,false},
            {status,runnable},
            {heap_size,377},
            {stack_size,0},
            {reductions,0}]}]]}}

[Thu, 15 Jul 2010 23:03:54 GMT] [error] [<0.22166.3>] ** Generic
server <0.22166.3> terminating
** Last message in was {'EXIT',<0.21959.3>,
                           {system_limit,
                               [{ets,new,[replication_stats,[set,private]]},
                                {couch_rep,do_init,1},
                                {couch_rep,init,1},
                                {gen_server,init_it,6},
                                {proc_lib,init_p_do_apply,3}]}}
** When Server state == {state,<0.22167.3>,nil,
                            {db,<0.21978.3>,<0.22062.3>,nil,
                                <<"1279235033964957">>,<0.21967.3>,
                                <0.22063.3>,
                                {db_header,5,0,0,nil,nil,nil,0,nil,nil,1000},
                                0,
                                {btree,<0.21967.3>,nil,
                                    #Fun<couch_db_updater.7.82129660>,
                                    #Fun<couch_db_updater.8.42953822>,
                                    #Fun<couch_btree.5.124754102>,
                                    #Fun<couch_db_updater.9.115326703>},
                                {btree,<0.21967.3>,nil,
                                    #Fun<couch_db_updater.10.103072508>,
                                    #Fun<couch_db_updater.11.104248294>,
                                    #Fun<couch_btree.5.124754102>,
                                    #Fun<couch_db_updater.12.125559248>},
                                {btree,<0.21967.3>,nil,
                                    #Fun<couch_btree.0.83553141>,
                                    #Fun<couch_btree.1.30790806>,
                                    #Fun<couch_btree.2.124754102>,nil},
                                0,<<"db_2213">>,

"/var/lib/mysql_data/couchdb-0.11.1-test/var/lib/couchdb/db_2213.couch",
                                [],[],nil,
                                {user_ctx,<<"network">>,
                                    [<<"_admin">>],
                                    <<"{couch_httpd_auth,
default_authentication_handler}">>},
                                nil,1000,
                                [before_header,after_header,on_file_open]},
                            <0.21959.3>,false,0,
                            {<0.22184.3>,#Ref<0.0.2.116318>},
                            {[],[]},
                            0,0,0}
** Reason for termination ==
** {system_limit,[{ets,new,[replication_stats,[set,private]]},
                  {couch_rep,do_init,1},
                  {couch_rep,init,1},
                  {gen_server,init_it,6},
                  {proc_lib,init_p_do_apply,3}]}


[Thu, 15 Jul 2010 23:03:54 GMT] [error] [<0.22166.3>] {error_report,<0.28.0>,
    {<0.22166.3>,crash_report,
     [[{pid,<0.22166.3>},
       {registered_name,[]},
       {error_info,
           {exit,
               {system_limit,
                   [{ets,new,[replication_stats,[set,private]]},
                    {couch_rep,do_init,1},
                    {couch_rep,init,1},
                    {gen_server,init_it,6},
                    {proc_lib,init_p_do_apply,3}]},
               [{gen_server,terminate,6},{proc_lib,init_p_do_apply,3}]}},
       {initial_call,{couch_rep_missing_revs,init,['Argument__1']}},
       {ancestors,
           [<0.21959.3>,couch_rep_sup,couch_primary_services,couch_server_sup,
            <0.29.0>]},
       {messages,[]},
       {links,[<0.22167.3>]},
       {dictionary,[]},
       {trap_exit,true},
       {status,running},
       {heap_size,233},
       {stack_size,23},
       {reductions,144}],
      []]}}

[Thu, 15 Jul 2010 23:03:54 GMT] [error] [<0.22182.3>] ** Generic
server <0.22182.3> terminating
** Last message in was {'EXIT',<0.21959.3>,
                           {system_limit,
                               [{ets,new,[replication_stats,[set,private]]},
                                {couch_rep,do_init,1},
                                {couch_rep,init,1},
                                {gen_server,init_it,6},
                                {proc_lib,init_p_do_apply,3}]}}
** When Server state == {state,<0.21959.3>,
                            {http_db,

"http://network:savetheSQL@g1dlsdbdb002.dev.glbt1.gdg:59845/db_462/",
                                [],[],
                                [{"User-Agent","CouchDB/0.11.1"},
                                 {"Accept","application/json"},
                                 {"Accept-Encoding","gzip"}],
                                [],get,nil,
                                [{response_format,binary},
                                 {inactivity_timeout,30000}],
                                10,500,nil},
                            <0.22166.3>,<0.22184.3>,[],0,
                            {[],[]},
                            nil,false,0,nil,[],[]}
** Reason for termination ==
** {system_limit,[{ets,new,[replication_stats,[set,private]]},
                  {couch_rep,do_init,1},
                  {couch_rep,init,1},
                  {gen_server,init_it,6},
                  {proc_lib,init_p_do_apply,3}]}


[Thu, 15 Jul 2010 23:03:54 GMT] [error] [<0.22182.3>] {error_report,<0.28.0>,
    {<0.22182.3>,crash_report,
     [[{pid,<0.22182.3>},
       {registered_name,[]},
       {error_info,
           {exit,
               {system_limit,
                   [{ets,new,[replication_stats,[set,private]]},
                    {couch_rep,do_init,1},
                    {couch_rep,init,1},
                    {gen_server,init_it,6},
                    {proc_lib,init_p_do_apply,3}]},
               [{gen_server,terminate,6},{proc_lib,init_p_do_apply,3}]}},
       {initial_call,{couch_rep_reader,init,['Argument__1']}},
       {ancestors,
           [<0.21959.3>,couch_rep_sup,couch_primary_services,couch_server_sup,
            <0.29.0>]},
       {messages,[]},
       {links,[<0.22184.3>]},
       {dictionary,[]},
       {trap_exit,true},
       {status,running},
       {heap_size,987},
       {stack_size,23},
       {reductions,282}],
      [{neighbour,
           [{pid,<0.22184.3>},
            {registered_name,[]},
            {initial_call,{erlang,apply,2}},
            {current_function,{gen,wait_resp_mon,3}},
            {ancestors,[]},
            {messages,
                [{'DOWN',#Ref<0.0.2.116318>,process,<0.22166.3>,
                     {system_limit,
                         [{ets,new,[replication_stats,[set,private]]},
                          {couch_rep,do_init,1},
                          {couch_rep,init,1},
                          {gen_server,init_it,6},
                          {proc_lib,init_p_do_apply,3}]}}]},
            {links,[<0.22182.3>]},
            {dictionary,[]},
            {trap_exit,false},
            {status,runnable},
            {heap_size,377},
            {stack_size,15},
            {reductions,14}]}]]}}

[Thu, 15 Jul 2010 23:03:54 GMT] [error] [<0.31207.0>] Uncaught error
in HTTP request: {error,
                                 {case_clause,
                                  {error,
                                   {{system_limit,
                                     [{ets,new,
                                       [replication_stats,[set,private]]},
                                      {couch_rep,do_init,1},
                                      {couch_rep,init,1},
                                      {gen_server,init_it,6},
                                      {proc_lib,init_p_do_apply,3}]},
                                    {child,undefined,

"a0bd902c5803e5fb8e59918c8805d776+continuous+create_target",
                                     {gen_server,start_link,
                                      [couch_rep,
                                       ["a0bd902c5803e5fb8e59918c8805d776",
                                        {[{<<"source">>,

<<"http://network:savetheSQL@g1dlsdbdb002.dev.glbt1.gdg:59845/db_462">>},
                                          {<<"target">>,<<"db_2213">>},
                                          {<<"continuous">>,true},
                                          {<<"create_target">>,true},
                                          {<<"cancel">>,false}]},
                                        {user_ctx,<<"network">>,
                                         [<<"_admin">>],
                                         <<"{couch_httpd_auth,
default_authentication_handler}">>}],
                                       []]},
                                     temporary,1,worker,
                                     [couch_rep]}}}}}

[Thu, 15 Jul 2010 23:03:54 GMT] [error] [<0.22081.3>] ** Generic
server <0.22081.3> terminating
** Last message in was {'EXIT',<0.21959.3>,
                           {system_limit,
                               [{ets,new,[replication_stats,[set,private]]},
                                {couch_rep,do_init,1},
                                {couch_rep,init,1},
                                {gen_server,init_it,6},
                                {proc_lib,init_p_do_apply,3}]}}
** When Server state == {state,nil,nil,
                            [<0.21959.3>,
                             {http_db,

"http://network:savetheSQL@g1dlsdbdb002.dev.glbt1.gdg:59845/db_462/",
                                 [],[],
                                 [{"User-Agent","CouchDB/0.11.1"},
                                  {"Accept","application/json"},
                                  {"Accept-Encoding","gzip"}],
                                 [],get,nil,
                                 [{response_format,binary},
                                  {inactivity_timeout,30000}],
                                 10,500,nil},
                             0,
                             [{<<"source">>,

<<"http://network:savetheSQL@g1dlsdbdb002.dev.glbt1.gdg:59845/db_462">>},
                              {<<"target">>,<<"db_2213">>},
                              {<<"continuous">>,true},
                              {<<"create_target">>,true},
                              {<<"cancel">>,false}]],
                            0,<0.22165.3>,
                            {1279,235033,989017},
                            false,0,<<>>,
                            {<0.22167.3>,#Ref<0.0.2.116315>},
                            {[],[]}}
** Reason for termination ==
** {system_limit,[{ets,new,[replication_stats,[set,private]]},
                  {couch_rep,do_init,1},
                  {couch_rep,init,1},
                  {gen_server,init_it,6},
                  {proc_lib,init_p_do_apply,3}]}


[Thu, 15 Jul 2010 23:03:54 GMT] [error] [<0.22081.3>] {error_report,<0.28.0>,
    {<0.22081.3>,crash_report,
     [[{pid,<0.22081.3>},
       {registered_name,[]},
       {error_info,
           {exit,
               {system_limit,
                   [{ets,new,[replication_stats,[set,private]]},
                    {couch_rep,do_init,1},
                    {couch_rep,init,1},
                    {gen_server,init_it,6},
                    {proc_lib,init_p_do_apply,3}]},
               [{gen_server,terminate,6},{proc_lib,init_p_do_apply,3}]}},
       {initial_call,{couch_rep_changes_feed,init,['Argument__1']}},
       {ancestors,
           [<0.21959.3>,couch_rep_sup,couch_primary_services,couch_server_sup,
            <0.29.0>]},
       {messages,
           [{ibrowse_async_response,
                {1279,235033,989017},
                {error,closing_on_request}},
            {'EXIT',<0.22165.3>,normal}]},
       {links,[]},
       {dictionary,[]},
       {trap_exit,true},
       {status,running},
       {heap_size,987},
       {stack_size,23},
       {reductions,903}],
      []]}}

[Thu, 15 Jul 2010 23:03:54 GMT] [info] [<0.31207.0>] Stacktrace:
[{couch_rep,start_replication_server,1},
             {couch_rep,replicate,2},
             {couch_httpd_misc_handlers,handle_replicate_req,1},
             {couch_httpd,handle_request_int,5},
             {mochiweb_http,headers,5},
             {proc_lib,init_p_do_apply,3}]

[Thu, 15 Jul 2010 23:03:54 GMT] [info] [<0.31207.0>] 172.19.68.122 - -
'POST' /_replicate 500

[Thu, 15 Jul 2010 23:03:54 GMT] [debug] [<0.31207.0>] httpd 500 error response:
 {"error":"case_clause","reason":"{error,\n    {{system_limit,\n
  [{ets,new,[replication_stats,[set,private]]},\n
{couch_rep,do_init,1},\n          {couch_rep,init,1},\n
{gen_server,init_it,6},\n          {proc_lib,init_p_do_apply,3}]},\n
  {child,undefined,\n
\"a0bd902c5803e5fb8e59918c8805d776+continuous+create_target\",\n
  {gen_server,start_link,\n             [couch_rep,\n
[\"a0bd902c5803e5fb8e59918c8805d776\",\n
{[{<<\"source\">>,\n
<<\"http://network:savetheSQL@g1dlsdbdb002.dev.glbt1.gdg:59845/db_462\">>},\n
                {<<\"target\">>,<<\"db_2213\">>},\n
{<<\"continuous\">>,true},\n
{<<\"create_target\">>,true},\n
{<<\"cancel\">>,false}]},\n               {user_ctx,<<\"network\">>,\n
                  [<<\"_admin\">>],\n
<<\"{couch_httpd_auth, default_authentication_handler}\">>}],\n
      []]},\n         temporary,1,worker,\n         [couch_rep]}}}"}

---

Re: Trying to get 5000+ databases replicating, no success thus far.

Posted by Jan Lehnardt <ja...@apache.org>.
On 16 Jul 2010, at 02:22, Chris Stockton wrote:

> […]
> For a quick test just to make sure the environmental variables being
> passed to erlang fix my issue, I changed the following in that script:
>   command="/usr/bin/erl +P 65536 -env ERL_MAX_ETS_TABLES 60000 -env
> ERL_MAX_PORTS 60000 $interactive_option -sasl errlog_type erro
> r +K true \
>        -env ERL_LIBS
> /var/lib/mysql_data/couchdb-0.11.1-test/lib/couchdb/erlang/lib
> -couch_ini $start_arguments -s couch"
>    if test "$BACKGROUND" = "true" -a "$RECURSED" = "false"; then
> 
> Now I am happily replicating a few thousand db's. Thanks for the
> helping hands. I will modify my init script accordingly to work with
> couchdb shell script.

Hooray! :) — You should be able to pass in the env vars in the traditional way:

  ERL_MAX_PORTS=60000 couchdb

or if you are in a sh script:

  ERL_MAX_PORTS=60000
  export ERL_MAX_PORTS
  couchdb

I'd avoid modifying the `couchdb` script itself. But it's great to see that the
quick test works :)

Cheers
Jan
-- 


Re: Trying to get 5000+ databases replicating, no success thus far.

Posted by Wendall Cada <we...@83864.com>.
  It would be really incredibly if you blogged about this, or shared 
your setup with the rest of us. :)

Wendall

On 07/15/2010 06:34 PM, J Chris Anderson wrote:
> On Jul 15, 2010, at 5:22 PM, Chris Stockton wrote:
>
>> Now I am happily replicating a few thousand db's.
> Music to my ears! Glad you go to the bottom of this one.
>
> Chris


Re: Trying to get 5000+ databases replicating, no success thus far.

Posted by J Chris Anderson <jc...@apache.org>.
On Jul 15, 2010, at 5:22 PM, Chris Stockton wrote:

> Now I am happily replicating a few thousand db's.

Music to my ears! Glad you go to the bottom of this one.

Chris

Re: Trying to get 5000+ databases replicating, no success thus far.

Posted by Chris Stockton <ch...@gmail.com>.
Hello,

On Thu, Jul 15, 2010 at 5:02 PM, Randall Leeds <ra...@gmail.com> wrote:
> You will want to set max_connections even higher.
> If you look in the [replicator] section of the ini you'll notice that
> each replication can use up to 10 connections plus the changes feed,
> so try bumping max_connections beyond 55,000.
>
> Finally, what system are you running this on?
> For example, on CentOS, the daemon function comes from
> /etc/rc.d/init.d/functions and it will call "runuser" to switch to the
> couchdb user and pass a "-" in the call, which creates a login shell.
>
> runuser is much like su. From `info su`:
> `-'
> `-l'
> `--login'
>     Make the shell a login shell.  This means the following.  Unset all
>     environment variables except `TERM', `HOME', and `SHELL' (which
>     are set as described above), and `USER' and `LOGNAME' (which are
>     set, even for the super-user, as described above), and set `PATH'
>     to a compiled-in default value.  Change to USER's home directory.
>     Prepend `-' to the shell's name, intended to make it read its
>     login startup file(s).  Additionaly `DISPLAY' and `XAUTHORITY'
>     environment variables are preserved as well for PAM functionality.
>
> However, couch still needs to be started from a directory where it can
> run "find", i.e. a directory it has permission to read and a non-login
> shell won't switch to the users home directory.
>
> Here's a snippet of my CentOS init script:
>
> cd $(eval echo ~$COUCHDB_USER)
> su $COUCHD_USER -c "$exec \
>   -r $COUCHDB_RESPAWN_TIMEOUT \
>   ....
>
> Could this be your issue?
>
> -Randall

Hello,

This lead me to actually take a look at what the couchdb script was
and how it worked, I was thinking it was binary but a quick file and I
noticed it was a shell script. I peeked at it and noticed the
start_arguments flag, this will service my purpose.

For a quick test just to make sure the environmental variables being
passed to erlang fix my issue, I changed the following in that script:
   command="/usr/bin/erl +P 65536 -env ERL_MAX_ETS_TABLES 60000 -env
ERL_MAX_PORTS 60000 $interactive_option -sasl errlog_type erro
r +K true \
        -env ERL_LIBS
/var/lib/mysql_data/couchdb-0.11.1-test/lib/couchdb/erlang/lib
-couch_ini $start_arguments -s couch"
    if test "$BACKGROUND" = "true" -a "$RECURSED" = "false"; then

Now I am happily replicating a few thousand db's. Thanks for the
helping hands. I will modify my init script accordingly to work with
couchdb shell script.

Kind Regards,

-Chris

Re: Trying to get 5000+ databases replicating, no success thus far.

Posted by Randall Leeds <ra...@gmail.com>.
You will want to set max_connections even higher.
If you look in the [replicator] section of the ini you'll notice that
each replication can use up to 10 connections plus the changes feed,
so try bumping max_connections beyond 55,000.

Finally, what system are you running this on?
For example, on CentOS, the daemon function comes from
/etc/rc.d/init.d/functions and it will call "runuser" to switch to the
couchdb user and pass a "-" in the call, which creates a login shell.

runuser is much like su. From `info su`:
`-'
`-l'
`--login'
     Make the shell a login shell.  This means the following.  Unset all
     environment variables except `TERM', `HOME', and `SHELL' (which
     are set as described above), and `USER' and `LOGNAME' (which are
     set, even for the super-user, as described above), and set `PATH'
     to a compiled-in default value.  Change to USER's home directory.
     Prepend `-' to the shell's name, intended to make it read its
     login startup file(s).  Additionaly `DISPLAY' and `XAUTHORITY'
     environment variables are preserved as well for PAM functionality.

However, couch still needs to be started from a directory where it can
run "find", i.e. a directory it has permission to read and a non-login
shell won't switch to the users home directory.

Here's a snippet of my CentOS init script:

cd $(eval echo ~$COUCHDB_USER)
su $COUCHD_USER -c "$exec \
   -r $COUCHDB_RESPAWN_TIMEOUT \
   ....

Could this be your issue?

-Randall

On Thu, Jul 15, 2010 at 16:41, Chris Stockton <ch...@gmail.com> wrote:
> Hello,
>
> On Thu, Jul 15, 2010 at 4:27 PM, Robert Dionne
> <di...@dionne-associates.com> wrote:
>> I've seen this message before when using mnesia, the default for ets tables is 1400. You might try setting the environment variable:
>>
>> ERL_MAX_ETS_TABLES
>>
>> to something higher
>>>
>>> These exist in my couchdb init script:
>>> ulimit -n 1000000
>>> export ERL_MAX_PORTS=100000
>>> export ERL_MAX_ETS_TABLES=10000
>
> Thank you Dionne, I actually have "export ERL_MAX_ETS_TABLES=10000"
> currently inside my init script. I am under the impression this is
> properly being read when couch starts, but maybe I need to pass them
> as flags to couchdb binary in my daemon command?
>
> -Chris
>

Re: Trying to get 5000+ databases replicating, no success thus far.

Posted by Robert Dionne <di...@dionne-associates.com>.
sorry, I didn't read your message closely, you have upped it.

From the stack it's clearly in the init function in couch_rep, trying to create another ets table, and hitting the limit. Someone more familiar with replication will have to look at it.



On Jul 15, 2010, at 7:41 PM, Chris Stockton wrote:

> Hello,
> 
> On Thu, Jul 15, 2010 at 4:27 PM, Robert Dionne
> <di...@dionne-associates.com> wrote:
>> I've seen this message before when using mnesia, the default for ets tables is 1400. You might try setting the environment variable:
>> 
>> ERL_MAX_ETS_TABLES
>> 
>> to something higher
>>> 
>>> These exist in my couchdb init script:
>>> ulimit -n 1000000
>>> export ERL_MAX_PORTS=100000
>>> export ERL_MAX_ETS_TABLES=10000
> 
> Thank you Dionne, I actually have "export ERL_MAX_ETS_TABLES=10000"
> currently inside my init script. I am under the impression this is
> properly being read when couch starts, but maybe I need to pass them
> as flags to couchdb binary in my daemon command?
> 
> -Chris


Re: Trying to get 5000+ databases replicating, no success thus far.

Posted by Chris Stockton <ch...@gmail.com>.
Hello,

On Thu, Jul 15, 2010 at 4:27 PM, Robert Dionne
<di...@dionne-associates.com> wrote:
> I've seen this message before when using mnesia, the default for ets tables is 1400. You might try setting the environment variable:
>
> ERL_MAX_ETS_TABLES
>
> to something higher
>>
>> These exist in my couchdb init script:
>> ulimit -n 1000000
>> export ERL_MAX_PORTS=100000
>> export ERL_MAX_ETS_TABLES=10000

Thank you Dionne, I actually have "export ERL_MAX_ETS_TABLES=10000"
currently inside my init script. I am under the impression this is
properly being read when couch starts, but maybe I need to pass them
as flags to couchdb binary in my daemon command?

-Chris

Re: Trying to get 5000+ databases replicating, no success thus far.

Posted by Robert Dionne <di...@dionne-associates.com>.
I've seen this message before when using mnesia, the default for ets tables is 1400. You might try setting the environment variable:

ERL_MAX_ETS_TABLES

to something higher



On Jul 15, 2010, at 7:18 PM, Chris Stockton wrote:

> Hello,
> 
> I have gone through a good amount of research and effort trying to get
> a large amount of databases replicating, with a good amount of help
> from this list. I have hit a road block and am unable to get more then
> 2000+ databases replicating.
> 
> Something tells me [1] might be part of my issue. I have downloaded
> and installed couchdb-0.11.1, I made sure that patch was present in
> the source. I included the limits in the INI file but they do not seem
> to be respected, or I am hitting a different kind of limit. Here [2]
> is the errors that couch starts throwing when I get to roughly 2048~
> (the default number of allowed connections).
> 
> These exist in my couchdb init script:
> ulimit -n 1000000
> export ERL_MAX_PORTS=100000
> export ERL_MAX_ETS_TABLES=10000
> 
> This is the init script start command:
> daemon --user couchdb "$exec -b -p
> /<dir>/couchdb-0.11.1-test/couch.pid -a
> /<dir>/couchdb-0.11.1-test/local.ini +P 65536"
> 
> I am certain the following local.ini is being parsed, as I run on a
> non-standard port, in addition I am certain the path is correct:
> [couchdb]
> os_process_timeout=60000
> max_dbs_open = 100000
> 
> [httpd]
> max_connections = 9000
> port = 59840
> bind_address = 0.0.0.0
> 
> At this point I am looking for some expertise from other people who
> have dealt with large-scale replication.
> 
> Kind Regards,
> 
> -Chris
> 
> [1] https://issues.apache.org/jira/browse/COUCHDB-705
> [2] ---
> 
> [Thu, 15 Jul 2010 23:03:53 GMT] [error] [emulator] ** Too many db tables **
> 
> 
> 
> [Thu, 15 Jul 2010 23:03:53 GMT] [error] [<0.21959.3>] {error_report,<0.28.0>,
>    {<0.21959.3>,crash_report,
>     [[{pid,<0.21959.3>},
>       {registered_name,[]},
>       {error_info,
>           {exit,
>               {system_limit,
>                   [{ets,new,[replication_stats,[set,private]]},
>                    {couch_rep,do_init,1},
>                    {couch_rep,init,1},
>                    {gen_server,init_it,6},
>                    {proc_lib,init_p_do_apply,3}]},
>               [{gen_server,init_it,6},{proc_lib,init_p_do_apply,3}]}},
>       {initial_call,{couch_rep,init,['Argument__1']}},
>       {ancestors,
>           [couch_rep_sup,couch_primary_services,couch_server_sup,<0.29.0>]},
>       {messages,[]},
>       {links,[<0.22081.3>,<0.22182.3>,<0.22268.3>,<0.22166.3>,<0.78.0>]},
>       {dictionary,[]},
>       {trap_exit,true},
>       {status,running},
>       {heap_size,2584},
>       {stack_size,23},
>       {reductions,2097}],
>      [{neighbour,
>           [{pid,<0.22268.3>},
>            {registered_name,[]},
>            {initial_call,{erlang,apply,2}},
>            {current_function,{erlang,apply,2}},
>            {ancestors,[]},
>            {messages,[]},
>            {links,[<0.21959.3>]},
>            {dictionary,[]},
>            {trap_exit,false},
>            {status,runnable},
>            {heap_size,377},
>            {stack_size,0},
>            {reductions,0}]}]]}}
> 
> [Thu, 15 Jul 2010 23:03:54 GMT] [error] [<0.22166.3>] ** Generic
> server <0.22166.3> terminating
> ** Last message in was {'EXIT',<0.21959.3>,
>                           {system_limit,
>                               [{ets,new,[replication_stats,[set,private]]},
>                                {couch_rep,do_init,1},
>                                {couch_rep,init,1},
>                                {gen_server,init_it,6},
>                                {proc_lib,init_p_do_apply,3}]}}
> ** When Server state == {state,<0.22167.3>,nil,
>                            {db,<0.21978.3>,<0.22062.3>,nil,
>                                <<"1279235033964957">>,<0.21967.3>,
>                                <0.22063.3>,
>                                {db_header,5,0,0,nil,nil,nil,0,nil,nil,1000},
>                                0,
>                                {btree,<0.21967.3>,nil,
>                                    #Fun<couch_db_updater.7.82129660>,
>                                    #Fun<couch_db_updater.8.42953822>,
>                                    #Fun<couch_btree.5.124754102>,
>                                    #Fun<couch_db_updater.9.115326703>},
>                                {btree,<0.21967.3>,nil,
>                                    #Fun<couch_db_updater.10.103072508>,
>                                    #Fun<couch_db_updater.11.104248294>,
>                                    #Fun<couch_btree.5.124754102>,
>                                    #Fun<couch_db_updater.12.125559248>},
>                                {btree,<0.21967.3>,nil,
>                                    #Fun<couch_btree.0.83553141>,
>                                    #Fun<couch_btree.1.30790806>,
>                                    #Fun<couch_btree.2.124754102>,nil},
>                                0,<<"db_2213">>,
> 
> "/var/lib/mysql_data/couchdb-0.11.1-test/var/lib/couchdb/db_2213.couch",
>                                [],[],nil,
>                                {user_ctx,<<"network">>,
>                                    [<<"_admin">>],
>                                    <<"{couch_httpd_auth,
> default_authentication_handler}">>},
>                                nil,1000,
>                                [before_header,after_header,on_file_open]},
>                            <0.21959.3>,false,0,
>                            {<0.22184.3>,#Ref<0.0.2.116318>},
>                            {[],[]},
>                            0,0,0}
> ** Reason for termination ==
> ** {system_limit,[{ets,new,[replication_stats,[set,private]]},
>                  {couch_rep,do_init,1},
>                  {couch_rep,init,1},
>                  {gen_server,init_it,6},
>                  {proc_lib,init_p_do_apply,3}]}
> 
> 
> [Thu, 15 Jul 2010 23:03:54 GMT] [error] [<0.22166.3>] {error_report,<0.28.0>,
>    {<0.22166.3>,crash_report,
>     [[{pid,<0.22166.3>},
>       {registered_name,[]},
>       {error_info,
>           {exit,
>               {system_limit,
>                   [{ets,new,[replication_stats,[set,private]]},
>                    {couch_rep,do_init,1},
>                    {couch_rep,init,1},
>                    {gen_server,init_it,6},
>                    {proc_lib,init_p_do_apply,3}]},
>               [{gen_server,terminate,6},{proc_lib,init_p_do_apply,3}]}},
>       {initial_call,{couch_rep_missing_revs,init,['Argument__1']}},
>       {ancestors,
>           [<0.21959.3>,couch_rep_sup,couch_primary_services,couch_server_sup,
>            <0.29.0>]},
>       {messages,[]},
>       {links,[<0.22167.3>]},
>       {dictionary,[]},
>       {trap_exit,true},
>       {status,running},
>       {heap_size,233},
>       {stack_size,23},
>       {reductions,144}],
>      []]}}
> 
> [Thu, 15 Jul 2010 23:03:54 GMT] [error] [<0.22182.3>] ** Generic
> server <0.22182.3> terminating
> ** Last message in was {'EXIT',<0.21959.3>,
>                           {system_limit,
>                               [{ets,new,[replication_stats,[set,private]]},
>                                {couch_rep,do_init,1},
>                                {couch_rep,init,1},
>                                {gen_server,init_it,6},
>                                {proc_lib,init_p_do_apply,3}]}}
> ** When Server state == {state,<0.21959.3>,
>                            {http_db,
> 
> "http://network:savetheSQL@g1dlsdbdb002.dev.glbt1.gdg:59845/db_462/",
>                                [],[],
>                                [{"User-Agent","CouchDB/0.11.1"},
>                                 {"Accept","application/json"},
>                                 {"Accept-Encoding","gzip"}],
>                                [],get,nil,
>                                [{response_format,binary},
>                                 {inactivity_timeout,30000}],
>                                10,500,nil},
>                            <0.22166.3>,<0.22184.3>,[],0,
>                            {[],[]},
>                            nil,false,0,nil,[],[]}
> ** Reason for termination ==
> ** {system_limit,[{ets,new,[replication_stats,[set,private]]},
>                  {couch_rep,do_init,1},
>                  {couch_rep,init,1},
>                  {gen_server,init_it,6},
>                  {proc_lib,init_p_do_apply,3}]}
> 
> 
> [Thu, 15 Jul 2010 23:03:54 GMT] [error] [<0.22182.3>] {error_report,<0.28.0>,
>    {<0.22182.3>,crash_report,
>     [[{pid,<0.22182.3>},
>       {registered_name,[]},
>       {error_info,
>           {exit,
>               {system_limit,
>                   [{ets,new,[replication_stats,[set,private]]},
>                    {couch_rep,do_init,1},
>                    {couch_rep,init,1},
>                    {gen_server,init_it,6},
>                    {proc_lib,init_p_do_apply,3}]},
>               [{gen_server,terminate,6},{proc_lib,init_p_do_apply,3}]}},
>       {initial_call,{couch_rep_reader,init,['Argument__1']}},
>       {ancestors,
>           [<0.21959.3>,couch_rep_sup,couch_primary_services,couch_server_sup,
>            <0.29.0>]},
>       {messages,[]},
>       {links,[<0.22184.3>]},
>       {dictionary,[]},
>       {trap_exit,true},
>       {status,running},
>       {heap_size,987},
>       {stack_size,23},
>       {reductions,282}],
>      [{neighbour,
>           [{pid,<0.22184.3>},
>            {registered_name,[]},
>            {initial_call,{erlang,apply,2}},
>            {current_function,{gen,wait_resp_mon,3}},
>            {ancestors,[]},
>            {messages,
>                [{'DOWN',#Ref<0.0.2.116318>,process,<0.22166.3>,
>                     {system_limit,
>                         [{ets,new,[replication_stats,[set,private]]},
>                          {couch_rep,do_init,1},
>                          {couch_rep,init,1},
>                          {gen_server,init_it,6},
>                          {proc_lib,init_p_do_apply,3}]}}]},
>            {links,[<0.22182.3>]},
>            {dictionary,[]},
>            {trap_exit,false},
>            {status,runnable},
>            {heap_size,377},
>            {stack_size,15},
>            {reductions,14}]}]]}}
> 
> [Thu, 15 Jul 2010 23:03:54 GMT] [error] [<0.31207.0>] Uncaught error
> in HTTP request: {error,
>                                 {case_clause,
>                                  {error,
>                                   {{system_limit,
>                                     [{ets,new,
>                                       [replication_stats,[set,private]]},
>                                      {couch_rep,do_init,1},
>                                      {couch_rep,init,1},
>                                      {gen_server,init_it,6},
>                                      {proc_lib,init_p_do_apply,3}]},
>                                    {child,undefined,
> 
> "a0bd902c5803e5fb8e59918c8805d776+continuous+create_target",
>                                     {gen_server,start_link,
>                                      [couch_rep,
>                                       ["a0bd902c5803e5fb8e59918c8805d776",
>                                        {[{<<"source">>,
> 
> <<"http://network:savetheSQL@g1dlsdbdb002.dev.glbt1.gdg:59845/db_462">>},
>                                          {<<"target">>,<<"db_2213">>},
>                                          {<<"continuous">>,true},
>                                          {<<"create_target">>,true},
>                                          {<<"cancel">>,false}]},
>                                        {user_ctx,<<"network">>,
>                                         [<<"_admin">>],
>                                         <<"{couch_httpd_auth,
> default_authentication_handler}">>}],
>                                       []]},
>                                     temporary,1,worker,
>                                     [couch_rep]}}}}}
> 
> [Thu, 15 Jul 2010 23:03:54 GMT] [error] [<0.22081.3>] ** Generic
> server <0.22081.3> terminating
> ** Last message in was {'EXIT',<0.21959.3>,
>                           {system_limit,
>                               [{ets,new,[replication_stats,[set,private]]},
>                                {couch_rep,do_init,1},
>                                {couch_rep,init,1},
>                                {gen_server,init_it,6},
>                                {proc_lib,init_p_do_apply,3}]}}
> ** When Server state == {state,nil,nil,
>                            [<0.21959.3>,
>                             {http_db,
> 
> "http://network:savetheSQL@g1dlsdbdb002.dev.glbt1.gdg:59845/db_462/",
>                                 [],[],
>                                 [{"User-Agent","CouchDB/0.11.1"},
>                                  {"Accept","application/json"},
>                                  {"Accept-Encoding","gzip"}],
>                                 [],get,nil,
>                                 [{response_format,binary},
>                                  {inactivity_timeout,30000}],
>                                 10,500,nil},
>                             0,
>                             [{<<"source">>,
> 
> <<"http://network:savetheSQL@g1dlsdbdb002.dev.glbt1.gdg:59845/db_462">>},
>                              {<<"target">>,<<"db_2213">>},
>                              {<<"continuous">>,true},
>                              {<<"create_target">>,true},
>                              {<<"cancel">>,false}]],
>                            0,<0.22165.3>,
>                            {1279,235033,989017},
>                            false,0,<<>>,
>                            {<0.22167.3>,#Ref<0.0.2.116315>},
>                            {[],[]}}
> ** Reason for termination ==
> ** {system_limit,[{ets,new,[replication_stats,[set,private]]},
>                  {couch_rep,do_init,1},
>                  {couch_rep,init,1},
>                  {gen_server,init_it,6},
>                  {proc_lib,init_p_do_apply,3}]}
> 
> 
> [Thu, 15 Jul 2010 23:03:54 GMT] [error] [<0.22081.3>] {error_report,<0.28.0>,
>    {<0.22081.3>,crash_report,
>     [[{pid,<0.22081.3>},
>       {registered_name,[]},
>       {error_info,
>           {exit,
>               {system_limit,
>                   [{ets,new,[replication_stats,[set,private]]},
>                    {couch_rep,do_init,1},
>                    {couch_rep,init,1},
>                    {gen_server,init_it,6},
>                    {proc_lib,init_p_do_apply,3}]},
>               [{gen_server,terminate,6},{proc_lib,init_p_do_apply,3}]}},
>       {initial_call,{couch_rep_changes_feed,init,['Argument__1']}},
>       {ancestors,
>           [<0.21959.3>,couch_rep_sup,couch_primary_services,couch_server_sup,
>            <0.29.0>]},
>       {messages,
>           [{ibrowse_async_response,
>                {1279,235033,989017},
>                {error,closing_on_request}},
>            {'EXIT',<0.22165.3>,normal}]},
>       {links,[]},
>       {dictionary,[]},
>       {trap_exit,true},
>       {status,running},
>       {heap_size,987},
>       {stack_size,23},
>       {reductions,903}],
>      []]}}
> 
> [Thu, 15 Jul 2010 23:03:54 GMT] [info] [<0.31207.0>] Stacktrace:
> [{couch_rep,start_replication_server,1},
>             {couch_rep,replicate,2},
>             {couch_httpd_misc_handlers,handle_replicate_req,1},
>             {couch_httpd,handle_request_int,5},
>             {mochiweb_http,headers,5},
>             {proc_lib,init_p_do_apply,3}]
> 
> [Thu, 15 Jul 2010 23:03:54 GMT] [info] [<0.31207.0>] 172.19.68.122 - -
> 'POST' /_replicate 500
> 
> [Thu, 15 Jul 2010 23:03:54 GMT] [debug] [<0.31207.0>] httpd 500 error response:
> {"error":"case_clause","reason":"{error,\n    {{system_limit,\n
>  [{ets,new,[replication_stats,[set,private]]},\n
> {couch_rep,do_init,1},\n          {couch_rep,init,1},\n
> {gen_server,init_it,6},\n          {proc_lib,init_p_do_apply,3}]},\n
>  {child,undefined,\n
> \"a0bd902c5803e5fb8e59918c8805d776+continuous+create_target\",\n
>  {gen_server,start_link,\n             [couch_rep,\n
> [\"a0bd902c5803e5fb8e59918c8805d776\",\n
> {[{<<\"source\">>,\n
> <<\"http://network:savetheSQL@g1dlsdbdb002.dev.glbt1.gdg:59845/db_462\">>},\n
>                {<<\"target\">>,<<\"db_2213\">>},\n
> {<<\"continuous\">>,true},\n
> {<<\"create_target\">>,true},\n
> {<<\"cancel\">>,false}]},\n               {user_ctx,<<\"network\">>,\n
>                  [<<\"_admin\">>],\n
> <<\"{couch_httpd_auth, default_authentication_handler}\">>}],\n
>      []]},\n         temporary,1,worker,\n         [couch_rep]}}}"}
> 
> ---