-
Notifications
You must be signed in to change notification settings - Fork 35
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
Implement Connection Pooling and Threading #91
base: master
Are you sure you want to change the base?
Conversation
Thanks, for this MR, I will review it asap. |
Thanks, for looking into this. |
I have published a beta release in "my" fork. If you like you can have look there... |
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.
Thank you for this great PR!
I have a few pieces of feedback based on my review.
I also need to test a few edge cases before I can approve it.
|
This implements Connection Pooling for the Snowflake Connection.
The code today doesn't reuse the snowflake connection. After each query the connection is dropped. This PullRequest will add ConnectionPooling to store open connections for later reuse. The poolsize and the connection timeout can be configured in the PluginConfig.
When the snowflake warehouse is in hard load it could be possible, that too much queries will be forwarded to snowflake, which will end in an overloaded Snowflake Warehouse. The poolsize will limit the concurrent queries which are forwarded to snowflake, but all additional Grafana queries will be stored in the query queue of the plugin. To drop new queries in the situation of overload a max. queued queries option is available. If more queries as configured are waiting a error will be returned to the panel. This will give snowflake the possibility to recover.
To implement the options in the ConfigEditor the editor code is changed from the legacy forms to the newer grafana forms.
If a Panel has multiple queries, the snowflake query will be done in multiple threads after this change.
All changes are speeding up the query execution and will reduce snowflake cloud query costs for connection creation.
This is the first pull-request. A second one implementing plugin-side caching is prepared. Please let me know if you are willing to implement such huge changes into your code base.