apache / pulsar

Apache Pulsar - distributed pub-sub messaging system
https://pulsar.apache.org/
Apache License 2.0
14.23k stars 3.58k forks source link

Pulsar-admin commands do not support parallelization #4021

Closed devinbost closed 5 years ago

devinbost commented 5 years ago

Describe the bug

Executing pulsar-admin commands in parallel via bash results in only the last command succeeding. The other commands are ignored.

To Reproduce

Steps to reproduce the behavior:

  1. Start docker standalone via: docker run -it -p 80:80 -p 8080:8080 -p 6650:6650 apachepulsar/pulsar-standalone
  2. Ensure that /etc/pulsar/client.conf is pointed to the standalone instance.
  3. Execute: pulsar-admin tenants create t1 & pulsar-admin tenants create t2 & pulsar-admin tenants create t3 & pulsar-admin tenants create t4 & pulsar-admin tenants create t5 & pulsar-admin tenants create t6 & pulsar-admin tenants create t7 & pulsar-admin tenants create t8 & pulsar-admin tenants create t9 & pulsar-admin tenants create t10 & pulsar-admin tenants create t11 & pulsar-admin tenants create t12 & pulsar-admin tenants create t13 & pulsar-admin tenants create t14 & pulsar-admin tenants create t15 & pulsar-admin tenants create t16 & pulsar-admin tenants create t17 & pulsar-admin tenants create t18 & pulsar-admin tenants create t19 & pulsar-admin tenants create t20 & pulsar-admin tenants create t21 & pulsar-admin tenants create t22 & pulsar-admin tenants create t23 & pulsar-admin tenants create t24 & pulsar-admin tenants create t25 & pulsar-admin tenants create t26 & pulsar-admin tenants create t27 & pulsar-admin tenants create t28 & pulsar-admin tenants create t29 & pulsar-admin tenants create t30 & pulsar-admin tenants create t31 & pulsar-admin tenants create t32 & pulsar-admin tenants create t33 & pulsar-admin tenants create t34 & pulsar-admin tenants create t35 & pulsar-admin tenants create t36 & pulsar-admin tenants create t37 & pulsar-admin tenants create t38 & pulsar-admin tenants create t39 & pulsar-admin tenants create t40
  4. Execute: pulsar-admin tenants list
  5. Notice that only the tenant t40 was created.

Namespaces have the same issue. Observe:

  1. Execute: pulsar-admin namespaces create t40/ns1 & pulsar-admin namespaces create t40/ns2 & pulsar-admin namespaces create t40/ns3 & pulsar-admin namespaces create t40/ns4 & pulsar-admin namespaces create t40/ns5 & pulsar-admin namespaces create t40/ns6 & pulsar-admin namespaces create t40/ns7 & pulsar-admin namespaces create t40/ns8 & pulsar-admin namespaces create t40/ns9 & pulsar-admin namespaces create t40/ns10 & pulsar-admin namespaces create t40/ns11 & pulsar-admin namespaces create t40/ns12 & pulsar-admin namespaces create t40/ns13 & pulsar-admin namespaces create t40/ns14 & pulsar-admin namespaces create t40/ns15 & pulsar-admin namespaces create t40/ns16 & pulsar-admin namespaces create t40/ns17 & pulsar-admin namespaces create t40/ns18 & pulsar-admin namespaces create t40/ns19 & pulsar-admin namespaces create t40/ns20 & pulsar-admin namespaces create t40/ns21 & pulsar-admin namespaces create t40/ns22 & pulsar-admin namespaces create t40/ns23 & pulsar-admin namespaces create t40/ns24 & pulsar-admin namespaces create t40/ns25 & pulsar-admin namespaces create t40/ns26 & pulsar-admin namespaces create t40/ns27 & pulsar-admin namespaces create t40/ns28 & pulsar-admin namespaces create t40/ns29 & pulsar-admin namespaces create t40/ns30 & pulsar-admin namespaces create t40/ns31 & pulsar-admin namespaces create t40/ns32 & pulsar-admin namespaces create t40/ns33 & pulsar-admin namespaces create t40/ns34 & pulsar-admin namespaces create t40/ns35 & pulsar-admin namespaces create t40/ns36 & pulsar-admin namespaces create t40/ns37 & pulsar-admin namespaces create t40/ns38

  2. Execute: pulsar-admin namespaces list t40

  3. Notice that only t40/ns38 was created.

Expected behavior

Note: This issue impacts fast/seamless continuous deployments.

Additional context

This issue relates to my comment in PR 4012: https://github.com/apache/pulsar/pull/4012#issuecomment-481472762

merlimat commented 5 years ago

I think the problem might be related with the memory settings. Each admin tool is starting a JVM which requires a considerable amount of mem.

Alternatives would be to either use the Java admin API to do these operations in bulk or go directly to REST API.