How to increase number of open connections for mongoDB from clients (C#)

mongoDB v4.0.4 >> replica set of 3 nodes (not sharded)

Previously

su - mongo7937
No directory, logging in with HOME=/
$ ulimit -Hn
1048576
$ ulimit -Sn
1024
$

cat /etc/pam.d/common-session | grep pam_limits.so

cat /etc/sysctl.conf | grep fs.file-max

changed to

su - mongo7937
No directory, logging in with HOME=/
$ ulimit -Hn
1048576
$ ulimit -Sn
64000
$

cat /etc/pam.d/common-session | grep pam_limits.so
session required        pam_limits.so

cat /etc/sysctl.conf | grep fs.file-max
fs.file-max = 2097152

sysctl -p

So earlier my max number of connections were limited to 818 which is 80% of 1024.
As per recommendation from mongoDB documentation I’ve increased the limit to 64000 but still when mongo c# client reaches max open connections to 818, my mongoDB abruptly stopping.

Is there working command set for c sharp driver to limit number of connection client end ?
because whatever we tried is not working, can someone share if that is working for you.

Else can someone tell me the right steps to limit number of open connections from mongoDB side and at server user level.

microsoft remote desktop blank screen when host PC’s (win10) monitor is off or not connected. Also LAN connections don’t work

as per title, everytime I try to connect using the android, iOS clients (official MS ones), it always shows an unresponsive black screen when the host PC’s monitor is off or disconnected. All my power settings are OK (no sleep, no hibernation, no auto turning off network card to save power etc etc). I’m really at a loss as it doesn’t give any error messages.

Another strange issue I’m having is all local network connections don’t work. It fails to connection everytime saying the PC can not be found regardless if I use IP address or PC name. I’ve disabled windows firewall too. Works fine over the internet though?

Any ideas?

Thanks a bunch!

ftps – vsftpd data connections fail when using ssl

I have vsftpd version 3.0.3-12 on Debian Buster that it works when using plain ftp but it fails when using ssl:

This the config file:

listen=yes
listen_ipv6=no
user_config_dir=/etc/vsftpd
anonymous_enable=NO
local_enable=YES
write_enable=YES
dirmessage_enable=YES
use_localtime=YES
xferlog_enable=YES
log_ftp_protocol=YES
connect_from_port_20=YES
ascii_upload_enable=YES
ascii_download_enable=YES
chroot_local_user=YES
chroot_list_enable=YES
chroot_list_file=/etc/vsftpd/vsftpd.chroot_list
ls_recurse_enable=YES
secure_chroot_dir=/var/run/vsftpd/empty
pam_service_name=vsftpd
rsa_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem
rsa_private_key_file=/etc/ssl/private/ssl-cert-snakeoil.key
ssl_enable=YES
debug_ssl=yes
pasv_enable=YES
pasv_min_port=10300
pasv_max_port=10305
force_local_logins_ssl=no
force_local_data_ssl=no
allow_anon_ssl=no
ssl_ciphers=HIGH
ssl_tlsv1=YES
ssl_sslv2=NO
pasv_address=w.x.y.z
chown_uploads=YES
hide_ids=YES
log_ftp_protocol=YES

When I try to connect from filezilla with “explicit ssl if available” it fails so:

Status: Connecting to w.x.y.z:2000...
Status: Connection established, waiting for welcome message...
Status: Initializing TLS...
Status: Verifying certificate...
Status: TLS connection established.
Status: Server does not support non-ASCII characters.
Status: Logged in
Status: Retrieving directory listing of "/test2"...
Command:        CWD /test2
Response:       250 Directory successfully changed.
Command:        PWD
Response:       257 "/test2" is the current directory
Command:        TYPE I
Response:       200 Switching to Binary mode.
Command:        PASV
Response:       227 Entering Passive Mode (w.x.y.z,40,60).
Command:        LIST
Error:  The data connection could not be established: ECONNREFUSED - Connection refused by server

Some notes:

  • w.x.y.z is a public ipv4 address
  • firewall makes DNAT from 2000 to 21 server port
  • Certificate is by now self-signed

What’s wrong with this configuration?

networking – Separate connections over 1 network cable

Consider the following network setup

                         ┌───────────────┐                                
┌────────────┐           │               │               ┌───────────────┐
│            │           │  2 Port RJ45  │               │               │
│ ISP / DHCP │──────────▶│  Socket Roof  │──────────────▶│ Unifi AP Roof │
│            │           │               │        B      │               │
└────────────┘     A     └───────────────┘               └───────────────┘
                                │  ▲                                      
                                │  │ B                                    
                                │  │                                      
                                │  │                                      
                             CAT6 Split                                   
                                into                                      
                              2x100MBit                                   
                                │  │                                      
                                │  │                                      
                              A │  │                                      
                                │  │                                      
                                ▼  │                                      
                         ┌───────────────┐                                
                         │  2 Port RJ45  │                                
                         │ Socket Ground │     B                          
                      ┌──│     Floor     │◀───────────────────────┐       
                      │  │               │                        │       
                      │  └───────────────┘                        │       
                      │                                           │       
                      │                                           │       
                   A  │                                           │       
                      │                                           │       
                      │      ┌────────┐               ┌────────┐  │       
                      │      │ Unifi  │        B      │ Unifi  │  │       
                      └─────▶│  USG   │──────────────▶│  PoE   │──┘       
                       WAN/1 │        │ LAN/1         │ Switch │          
                             └────────┘               └────────┘                  

Now the issue is there is only one cable run from the roof to the network rack on the ground floor. To get 2 connections out of this I have split the CAT6 cable up into 2×100 MBit using 4 wires each.

So the network is as follows:

  • The ISP comes in on the roof via a standard RJ45 (radio relay)
  • The cable is then connected to a 2 port socket (port A) I wired up to split the cable into
    2x100MBit
  • On the ground floor the cable from A is connected to the USGs WAN/1 port.
  • From the USG LAN/1 port it goes to a PoE switch that connects the rest of the local lan
  • One PoE port from that switch goes back to the 2 Port socket on port B
  • Port B of the socket on the roof is then connected to the AP

Now I can’t say I really like this setup very much. The reasons this is set up this way is

  1. I am a network noob and probably don’t know better
  2. I wanted to power the roof AP via POE without an additional injector (not that important)
  3. I wanted to isolate the ISPs DHCP by splitting it into 2 physical connections and using the USGs DHCP instead (important)

So the question is:

Can I achieve those goals without splitting the cable up into 2x100MBit, e.g. using a USW Flex Mini switch?

Identifying processes that open MySQL connections

I need to identify which application process issues a large number of MySQL connections.

The show processlist sql command or tools like innotop do not really help, as they only show db user and host, and i doubt that i catch all statements that way.

I was thinking to use something on the network level, like tcpdump or netstat. Any suggestions?

c# – Optimizations on a function that fIlters a list of connections

Hello fellow programmers, I am currently implementing a function and wanted to know if there was anything I could change to simplify the code, make it more readable, or to optimize the running time and memory usage. My current implementation works as expected, without any bugs.

The function I am implementing is called FilterConnectionSet() and filters a given set of connections based on some criteria, and returns a list containing only the connections that satisfy those criteria.

Each connection is linked to what we call a container, which is basically an external tool that can be attached to our software. Each containers has a given type (A, B, C, etc.). When a container is changed/updated, there is a variable named modifiedContainers of type ContainerDictionary that is automatically updated to include the modified container. Note that this variable is passed as a parameter to my function. I cannot change the code that updates the list of modified containers. All I can say is that ContainerDictionary is basically a custom class that wraps a Dictionary<>.

Before performing any container related operation in our software, we perform a “refresh” by importing all the latest data from all the attached containers. However, for performance purposes, we do not want to import data from containers that were not updated since the last refresh. Additionally, even if we do not support that feature yet, multiple containers of a specific type (let’s call it TypeA) type can be attached to our software at the same time. In that case, we want to group those containers based on some other properties, and only import the data of a single container per group, and display a warning message to the user that the data of the other containers of the same group were discarded.

Please note that I can only change the function that filters the connections. I cannot make any changes to the functions that takes care of updating the modifiedContainers list, or the actual import of data, or anything else not shown in this questions.

Here’s how my FilterConnectionSet function works:

  1. The function takes connectionSet (the list of connections to be filtered) and modifiedContainers (a list of containers that have been recently updated) as parameters.
  2. It then loops through all the connections and and separates all the connections to containers of TypeA. All remaining connections are automatically added to the list of filtered connections.
  3. Using LinQ, the connections of TypeA are then split in different groups based on the other properties.
  4. The function loops through each groups and does the following:
    • Define a connectionToAdd variable, and initialize to last connection in the group.
    • Loop through all the connection in the group
      • IF the connection is not linked to a container in the modifiedContainers list, THEN go to the next connection in the group.
      • ELSE, update the connectionToAdd variable.
    • IF there was more than one connection in the group, THEN display the message stating the only one container data will be imported.
    • Add the connection stored inside the connectionToAdd variable to the list of filtered connections.
    • Go to the next group of connection and repeat
  5. Return the list of filtered connections

Here is my current implementation:

    private static List<Connection> FilterConnectionSet(List<Connection> connectionSet, ContainerDictionary modifiedContainers)
    {
        var filteredConnectionSet = new List<Connection>();
        var typeAConnections = new List<Connection>();
        
        foreach (var connection in connectionSet)
        {
            // Check connection Type. If TypeA, add to list of TypeA connections, else add to filtered set. 
            if (connection.Type == "TypeA")
            {
                typeAConnections.Add(connection);
            }
            else
            {
                filteredConnectionSet.Add(connection);
            }
        }

        // Group the connections of TypeA based on other properties
        var groupedTypeAConnections = typeAConnections.GroupBy(c => new {c.property1, c.property2});

        foreach (var connectionGroup in groupedTypeAConnections)
        {
            var connectionToAdd = connectionGroup.Last();

            foreach (var connection in connectionGroup)
            {
                // Please note here the the ContainerInModifiedList function is a helper function that cannot be changed.
                if (!ContainerInModifiedList(connection, modifiedContainers))
                {
                    continue;
                }

                connectionToAdd = connection;
            }

            // If there is more than one connection in the group, display warning message. Please not that the helper function for displaying messages cannot be changed.
            if (connectionGroup.Count() > 1)
            {
                var warningMessage = string.Format("Multiple containers with property1 = {0} and property2 = {1} were detected. Only the container {2} will be imported!",
                    connectionToAdd.property1,
                    connectionToAdd.property2,
                    connectionToAdd.Container.Name);

                ErrorHelper.PublishWarningMessage(warningMessage);
            }

            filteredConnectionSet.Add(connectionToAdd);
        }

        return filteredConnectionSet;
    }

I hope I provided enough details.

I am open to any comments and suggestion!

hotshoe flash – Hot shoe pinouts / connections – do any of them provide power?

I’ve got an idea for a little project that uses the hot-shoe on top of the camera – I’m aware that the standard centre pin / foot connection is a universal thing but it would be useful if I could take power from the camera too.

My specific camera is a Pentax K5 which has a couple of extra contacts on the shoe, I don’t know if this is Pentax-specific or a more universal standard that came along.

Does anyone have any information on the electrical side of the hot shoe, is there any sort of standard or does each manufacturer do their own thing? Any pinouts, voltages etc. would be greatly appreciated.

Howto set Gmail “Basic HTML” as Default/Standard (for slow connections)

is use “Basic HTML” very often vor gmail and i want have this as default.

My internet recherche told my it should be possible.

“To set the Basic HTML view as your default so that you don’t need to select the link every time you sign in, click “Set Basic HTML as Default View” at the top of the Gmail account screen when you’re using Basic HMTL view.”

i dont see a button “Set Basic HTML as Default View”

And this Page sound hopeful: https://smallbusiness.chron.com/make-gmail-display-mail-basic-html-44852.html

But i was not able to to this. Is this still possible and how?

https://mail.google.com/mail/u/0/h/1psomethindr/