-
Notifications
You must be signed in to change notification settings - Fork 114
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[snmp]: Remove redundant connections to dbs #264
base: master
Are you sure you want to change the base?
Conversation
db connect is done to all required DBs in the initialization of each MIB class Signed-off-by: Suvarna Meenakshi <sumeenak@microsoft.com>
@@ -232,9 +232,6 @@ def init_mgmt_interface_tables(db_conn): | |||
:return: tuple of mgmt name to oid map and mgmt name to alias map | |||
""" | |||
|
|||
db_conn.connect(CONFIG_DB) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Redis DB is not meant to handle too many connections ...there is a limit to number of connections. Each process should establish connection once in its life time and then use the same connection to do any queries ...any number of times. Too many connections request may result in hitting this error
Yes it is not periodic, but in places where we do "init_namespace_dbs()", we do not need to connect again as "init_namespace_dbs" also connects to all required DBs in all namespaces. |
Signed-off-by: Suvarna Meenakshi sumeenak@microsoft.com
- What I did
init_namespace_dbs() function establishes connections to all required DBs in all namespaces.
There are various connections done in periodic functions like reinit_data() or update_data() which creates many connections and increases the number of open fds for sonic_ax_impl processes eventually leading to error logs like:
- How I did it
Remove establishing connections in periodic functions when the connection is already established during init.
- How to verify it
- Description for the changelog