Skip to content

Commit 4243222

Browse files
committed
Improve CTL_OVER_HTTP
1 parent f5903e3 commit 4243222

1 file changed

Lines changed: 12 additions & 6 deletions

File tree

content/admin/guide/managing.md

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -90,18 +90,22 @@ The `ejabberdctl commands` are:
9090
9191
<!-- md:version added in [25.03](../../archive/25.03/index.md) -->
9292
93-
The `ejabberdctl` script can execute ejabberd API commands inside the running ejabberd node. For this, the script starts another erlang virtual machine and connects it to the already existing one that is running ejabberd.
93+
The `ejabberdctl` script can execute ejabberd API commands inside the running ejabberd node.
9494
95-
This connection method is acceptable for performing a few administrative tasks (reload configuration, register an account, etc). However, ejabberdctl is noticeably slow for performing multiple calls, for example to register 1000 accounts. In that case, it is preferable to send ReST queries over HTTP to mod_http_api.
95+
By default this is done by starting another erlang virtual machine
96+
and connecting it to the already existing one that is running ejabberd.
97+
That method is acceptable for performing a few administrative tasks (reload configuration, register an account, etc). However, ejabberdctl is noticeably slow for performing multiple calls, for example to register 1000 accounts.
9698
97-
ejabberdctl can be configured to use an HTTP connection to execute the command, which is way faster than starting an erlang node, around 20 times faster.
99+
An alternative method is to configure ejabberdctl to use `curl`
100+
and send ReST queries over HTTP to mod_http_api.
101+
This is way faster than starting an erlang node, around 20 times faster.
98102
99103
To enable this feature, first configure in `ejabberd.yml`:
100104
101105
```yaml
102106
listen:
103107
-
104-
port: "unix:sockets/ctl_over_http.sock"
108+
port: "unix:ctl_over_http.sock"
105109
module: ejabberd_http
106110
tag: "ctl_over_http"
107111
unix_socket:
@@ -120,19 +124,21 @@ api_permissions:
120124
Then enable CTL_OVER_HTTP in `ejabberdctl.cfg`:
121125
122126
```sh
123-
CTL_OVER_HTTP=sockets/ctl_over_http.sock
127+
CTL_OVER_HTTP=ctl_over_http.sock
124128
```
125129
126130
Let's register 100 accounts using the standard method and CTL_OVER_HTTP:
127131

128132
```sh
133+
# This is CTL_OVER_HTTP disabled
129134
$ time for (( i=100 ; i ; i=i-1 )) ; do ejabberdctl register user$i localhost pass; done
130135
...
131136
real 0m43,929s
132137
user 0m41,878s
133138
sys 0m10,558s
134139
135-
$ time for (( i=100 ; i ; i=i-1 )) ; do CTL_OVER_HTTP=sockets/ctl_over_http.socket ejabberdctl register user$i localhost pass; done
140+
# This is CTL_OVER_HTTP=ctl_over_http.socket
141+
$ time for (( i=100 ; i ; i=i-1 )) ; do ejabberdctl register user$i localhost pass; done
136142
...
137143
real 0m2,144s
138144
user 0m1,377s

0 commit comments

Comments
 (0)