Skip to content

perf: avoid normal port use scheduler polling.#105

Draft
qzhuyan wants to merge 1 commit into
emqx:emqx-OTP-24.3.4from
qzhuyan:dev/william/avoid-normal-port-use-sch-polling
Draft

perf: avoid normal port use scheduler polling.#105
qzhuyan wants to merge 1 commit into
emqx:emqx-OTP-24.3.4from
qzhuyan:dev/william/avoid-normal-port-use-sch-polling

Conversation

@qzhuyan
Copy link
Copy Markdown

@qzhuyan qzhuyan commented May 12, 2026

since OTP21 , beam use epoll and have separate thread(s) to call the epoll.
https://www.erlang.org/blog/io-polling/

these threads can be scaled up and pollset could be scaled as well.

however, the ports will be 'upgraded' to the scheduler polling epoll set. (ERTS_POLL_USE_SCHEDULER_POLLING) if it is active and be epoll ready for 10 times.

This patch bump 10 to 999 times.

Another workaround is to have lower active_n for network ports, e.g. {active, 10}.

@qzhuyan
Copy link
Copy Markdown
Author

qzhuyan commented May 13, 2026

Old:

3m11s connect_succ total=18062 rate=94.12/sec
3m12s pub total=14139916 rate=144886.00/sec

New:
3m41s connect_succ total=20120 rate=58.06/sec
3m42s pub total=18392634 rate=193500.54/sec

@qzhuyan
Copy link
Copy Markdown
Author

qzhuyan commented May 13, 2026

5.10.3(core1@127.0.0.1)152> erlang:system_info(check_io).
[[{name,erts_poll},
  {primary,poll},
  {kernel_poll,false},
  {memory_size,25248},
  {total_poll_set_size,1},
  {lazy_updates,true},
  {pending_updates,0},
  {batch_updates,false},
  {concurrent_updates,false},
  {fallback,true},
  {max_fds,1024000},
  {active_fds,0},
  {poll_threads,0}],
 [{name,erts_poll},
  {primary,epoll},
  {kernel_poll,epoll},
  {memory_size,56},
  {total_poll_set_size,7},  <----------正常
  {lazy_updates,false},
  {pending_updates,0},
  {batch_updates,false},
  {concurrent_updates,true},
  {fallback,false},
  {max_fds,1024000},
  {active_fds,0},
  {poll_threads,0}],
 [{name,erts_poll},
  {primary,epoll},
  {kernel_poll,epoll},
  {memory_size,114744},
  {total_poll_set_size,1804}, <----------正常
  {lazy_updates,false},
  {pending_updates,0},
  {batch_updates,false},
  {concurrent_updates,true},
  {fallback,false},
  {max_fds,1024000},
  {active_fds,0},
  {poll_threads,4}]]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant