Hi Haoyang Liu and community

I am thinking about SQL and Database analysis solution for a whole. Here are 
some my thoughts and proposal. Feedback are welcome. 
Also, because I am not working on implementing this feature, all these are 
suggestions.


# Inventory changes
All metadata need register in SkyWalking. So Database instances do the same. 
Right now, we provide a virtual service metadata for each database instance.
So we need following adjustments.
1. network_address_inventory src_layer should be renamed as `type`. I know we 
want to keep upgrade compatible, this is just a suggestion. Because SrcLayer is 
hard to understand for people.
2. service_instance_inventory and service_inventory add field `type` to bring 
network_address_inventory's type to higher level.


# SQL Register
SQL statements are tons in real cluster, we can't and needn't to register and 
do for all of them. 
First of all, we just register slow SQL statement, such as slower than `10ms`? 
(Could provide settings for this). 
Also, keep register number has a limit, such as, for each collector instance, 
would do slow SQL statement register over 10K times in 30mins.
Then, because register is async way, we could have two solution
1. Use file buffer, waiting for register finished. Like mesh and trace data 
register. Advantage, one time slow SQL could be catch. Disadvantage, not 
quickly, especially the application codes are bad, don't use prepare statement.
2. Just send the register, and don't wait. Ignore this time access. 
Disadvantage, clearly, some first times slow SQL access missed. Delay the 
opportunities to address slow SQL.
We could discuss about these two.


# Source
DBAccess source should be easy, include, db service id, latency, timestamp, 
status.
SQLStatement sources could be in two 
1. ServiceSQLStatement, use service id + sql id as entity id, and include 
latency, timestamp, status.
2. EndpointSQLStatement, use endpoint id + sql id as entity id, and include 
latency, timestamp, status.


# Query and UI
1. Show Database service list
2. Show metric for database cpm, SLA, avg response time, even P99/95...
3. Show topN slow SQL from ServiceSQLStatement by aggregation query in database 
query page.
4. Show topN slow SQL from EndpointSQLStatement with Endpoint related info 
attached in database query page. 


Here are all in my mind.




------------------
Sheng Wu
Apache SkyWalking, ShardingSphere, Zipkin
Twitter, wusheng1108

Reply via email to