Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Motivation

Currently, running the rule like following will create a connection to the certain database sink.

...

If we create 5000 rules, and it will create 5000 connections to the certain database sink which may crash the database sink due to too many connections. Thus, we want to limit the connections to the database sink, and make the rules shared the same database connection pool if they have the same database driver and DSN.

...

Original Design

For now, each SinkNode would maintain one *sql.DB, when we Open the SinkNode, one *sql.DB would be created and used by this SinkNode 

...

In this way, each rule will create one SQL connection if it has a SQL sink which may cause lots of connections created due to mass rules.

New Implementation

As the Golang documents said, *sql.DB  is a handle of the database connections, that is to say, *sql.DB worked as a database connection pool.

...