langgenius / dify

Dify is an open-source LLM app development platform. Dify's intuitive interface combines AI workflow, RAG pipeline, agent capabilities, model management, observability features and more, letting you quickly go from prototype to production.
https://dify.ai
Other
52.37k stars 7.64k forks source link

Feat: Supports read and write separation in postgresql #9862

Open luckylhb90 opened 4 weeks ago

luckylhb90 commented 4 weeks ago

Self Checks

1. Is this request related to a challenge you're experiencing? Tell me about your story.

Because within our team, we've been heavily promoting the use of DIFY internally. One of the challenges is that single-machine postgresql can't handle the volume of requests. The postgresql is faulty for many times.

So we need to support postgresql's read-write separation feature. But I don't think that's enough to solve the problem completely. But at the moment, it seems that this may help to improve the current problem.

2. Additional context or comments

Further thoughts are: Database sharding and splitting, service decomposition , use mq, etc... These are all aspects that could be considered.

3. Can you help us with this feature?

luckylhb90 commented 2 weeks ago

Based on our usage, I also want to make some additions: 1: pgsql There are a few tables we need to focus on, their data volume is growing rapidly, we need to consider how to optimize: document_segments dataset_keyword_tables conversations messages workflow_runs workflow_node_executions

2: redis redis grew too fast because there was no specific understanding of the logic of the relevant code, and it was uncertain whether it was being used correctly.

image

3: llm Although the load balancing policy is now supported, the retry policy is missing because we have found that there are times when the model is not stable and it might be better to try again.