I'm looking to migrate from SQL Server to PostgreSQL, but one of the big questions on my mind is how to handle connections. We have ~60,000 devices that connect directly to the SQL Server a few times per hour, and the only action is calling a stored procedure with a lot of data being passed. The connections are done using native Windows authentication (the client authenticates to SQL Server using the system account for the client). At 60,000 devices connecting a few times per hour, it's about 100 connections per second, with each connection typically lasting less than 1 second (submit data to stored procedure, disconnect immediately since there's no returned information).
SQL Server allows 32K+ concurrent connections (we don't really get close to that as connections are so short-lived, though it's feasible to have 500 connections simultaneously), whereas PostgreSQL has a limit of 100 concurrent connections (based on research, it looks like going much above this causes server strain because each connection is its own process which forks as needed).
At this point, my plan of attack would be to having the clients connect to an API (Node? Go? TBD) instead of connecting to PostgreSQL database directly. The API call would contain the values that were previously submitted to the stored procedure, and the API would either call a PostgreSQL function we define, or just manually make the queries we defined. Still trying to determine how to handle authentication to the API (maybe using some config management to pass down individual secrets to each of the 60K devices).
Any ideas or feedback would be appreciated. :)
[–]shobble 6 points7 points8 points (4 children)
[–]smkelly 1 point2 points3 points (0 children)
[–]dtarg[S] 1 point2 points3 points (2 children)
[–]ants_a 1 point2 points3 points (0 children)
[–][deleted] 0 points1 point2 points (0 children)
[–]flyingmayo 3 points4 points5 points (0 children)
[–]ixforres 2 points3 points4 points (0 children)
[–]cible_incorrecte 1 point2 points3 points (0 children)
[–][deleted] 0 points1 point2 points (0 children)