O
O
OneTwoThreeFourFive2021-12-31 12:05:08
linux
OneTwoThreeFourFive, 2021-12-31 12:05:08

Increase tcp connection limit for websocket?

Used by workerman for websocket. The maximum number of connections is 1024 or sometimes 1090 connects. OS ubuntu.
Tried changing ubuntu open files limit and other settings. It's still some kind of limit.
Did the same as written on stackoverflow
https://stackoverflow.com/questions/410616/increas... .

Rebooted the server and the settings are reset.
If you do not restart the server, the settings remain, but do not affect anything.

ruvds hosting.
1 core
1 gb ram

1000 connections take approximately 8 mb.

So far, messages are not sent to the client and from the client to the server. I'm trying to remove the limits. That is, there is no load on the server, just connections.

Added:
Settings in /etc/security/limits.conf

#*               soft    core            0
#root            hard    core            100000
#*               hard    rss             10000
#@student        hard    nproc           20
#@faculty        soft    nproc           20
#@faculty        hard    nproc           50
#ftp             hard    nproc           0
#ftp             -       chroot          /ftp
#@student        -       maxlogins       4

* soft nofile 10000000
* hard nofile 10000000
root soft nofile 10000000
root hard nofile 10000000

# End of file


I entered the command sudo prlimit --pid 13834 --nofile=8192:16384 and after that I entered the command without --nofile=8192:16384
61cecca31356f471459981.png

Do I need to restart the server after the changes?
For now, there is still a limit.

How to increase the connection limit?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Arman, 2015-09-09
@Arik

Might do better

SELECT * FROM `lala` WHERE `id` IN ('13', 'dsd', '432')

A
Alexander Prozorov, 2015-09-09
@Staltec

var async = require('async');
var mysqlConnect = ... // 
var AT_THE_SAME_TIME_LIMIT = 3; // лимит количества одновременных асинхронных обработок.

async.mapLimit(['13', 'dsd', '432'], AT_THE_SAME_TIME_LIMIT, function iterator (id, cb) {
  mysqlConnect.query("SELECT * FROM `lala` WHERE `id`=?", [id], function (err, result) {
    cb(err, result);
  });
}, function final (err, results) {
  if (err) throw new Error(err);

  console.log(results);
});

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question