Architecture Dify

Dify's Strengths: RAG, Workflows and Its Resource Needs

Dify is one of the most resource-hungry services here (2 CPU cores, 10 GB of storage). Why its architecture needs that, and what RAG and workflow orchestration solve.

E
Eric Founder, Roamer Tech · · 7 min read

Want to start now? Deploy your Dify in 60 seconds

AI app platform — build your AI with no code. From NT$1,599/mo.

Subscribe to Dify

Dify on RoamerHost is NT$1,599/mo, at the higher end of our price range. This article explains why — not because the software costs money (Dify is open source), but because its architecture genuinely needs those resources.

The 30-second version

ItemDetail
Why it needs more resourcesA multi-container architecture, not a single app
Where model inference runsNot on your machine — on the provider’s
What your instance handlesOrchestration, retrieval, knowledge base management
The heaviest stepParsing documents and building the index
The bar for self-hostingManaging a whole set of containers, not one

Dify is a set of services, not a single application

A full Dify deployment includes an API service, background workers, a vector database, a relational database and a cache layer. Compared with the “single Node.js process” architecture of something like n8n, that is a completely different order of magnitude.

It shows up directly in the plan specs:

ItemDifyFor comparison: n8n
CPU2 cores1 core
Storage10 GB2 GB
PriceNT$1,599/moavg. NT$499/mo (billed yearly)

The 10 GB of storage is mainly for the knowledge base — original documents, the text after chunking, and the vector index all have to be stored.

What a RAG knowledge base solves

Pasting company documents straight into a ChatGPT conversation has two hard limits: the amount of content is capped by the context window, and you have to paste it again in every new conversation.

RAG (retrieval-augmented generation) works like this: documents are split into small chunks, converted into vectors and stored in a database; when a user asks something, the question is used to retrieve the most relevant fragments, and those fragments go to the model together with the question.

The practical benefit is that knowledge base size is no longer limited by the context window — you can load hundreds of documents, because only the most relevant fragments reach the model each time. The side benefit is cost: far fewer tokens go into the model.

Note that RAG quality depends heavily on the chunking strategy. Chunks that are too small lose their context; chunks that are too large reduce retrieval precision. Dify’s interface lets you adjust chunking parameters and test the results directly, which is where it saves you effort compared with writing your own RAG pipeline.

Workflow orchestration: a layer above a plain chatbot

Dify does more than chat interfaces. Its workflow orchestration turns “call a model” into one node in a flow, with conditional logic, data processing and external API calls before and after it.

In practice that means you can build multi-step applications — “detect the user’s intent → branch to different handling logic → query an internal system → use the model to compose a reply” — rather than simple question-and-answer.

You supply your own model API key

To be clear about this: Dify is an application development platform and does not include the models themselves. You need your own API key from OpenAI, Anthropic or another provider, and you pay the model usage charges directly to that provider.

The upside is full control over which model you use and how much you spend, plus the ability to switch providers at any time. The downside is one extra step during initial setup.

What managed hosting takes off your plate

This architectural complexity does not disappear because the service is managed; it just moves to someone else. What actually gets taken off your plate is four things:

  • Version compatibility between components — which ones have to be upgraded together
  • Resource allocation — how much memory each container should get
  • Backup completeness — the database, the vector index and the original files all have to be backed up together
  • Diagnosis when something breaks — every symptom looks like “something is off”, and you have to know where to start looking

The fourth is the most time-consuming and the hardest to put a price on. It is not a one-off learning cost; it is something you go through again every time something breaks.

What it is actually made of

Understand this and you will see why self-hosting costs more to operate than an ordinary application:

ComponentWhat it doesWhat happens if it dies
API serviceCore logicThe whole service is unusable
WorkerBackground jobs (document parsing, indexing)Uploads stay stuck in processing
Front endThe interfaceIt will not open, but the API is still alive
Relational databaseApp settings, conversation historyData is lost
CacheJob queue and temporary storageBackground jobs stall
Vector databaseThe knowledge base retrieval indexThe knowledge base stops working

The point is the last column: whichever component has a problem, the symptom presents as “Dify is behaving oddly”, and it is on you to work out which one it is. That is the real cost of self-hosting — not the few hours of installation, but the troubleshooting time every time something goes wrong afterwards.

A common misconception

“AI is CPU-hungry, so I need a bigger plan.”

In reality you are calling an external model, and all the inference runs on the provider’s servers. Your instance only assembles the question, sends it out and receives the answer. That part barely touches your compute resources — it hits your API bill instead.

So adding vCPUs does nothing at all for “answers are slow”; that is the model’s response time. What actually does consume resources is covered in resource limits.

FAQ

Q: Why can it not be a single container like n8n?

Because what it has to do is inherently several roles: responding to requests in real time, processing documents in the background, storing structured data, and storing a vector index. Cramming that into one container would let any one of them drag down the rest.

Q: Is the managed architecture the same as self-hosted?

The components are the same; the difference is who maintains and monitors them.

Q: What is a vector database?

It is where the knowledge base index lives. After a document is split into segments, each segment produces a set of numbers representing its meaning, and retrieval means finding the closest ones in there. When it breaks, the symptom is “the knowledge base clearly has data but nothing comes back”.

Q: Where is data stored?

App settings and conversation history live in the relational database, the knowledge base index lives in the vector database, and original files are stored separately. Backups have to cover all of it; backing up only one of them is incomplete.

Q: Do upgrades affect my data?

Version updates sometimes come with changes to data structures. If you self-host, always back up before upgrading and check the official release notes for breaking changes first.

What this article is actually for

You do not need to memorise the names of six containers. There are really only two things to take away:

1. Dify is more complex than you think, so the cost of self-hosting is mostly operations, not installation. Finding a “one-click deploy” tutorial does not mean you are done from then on.

2. When something breaks, first work out which layer it is — the model, retrieval, or a component. The fixes are completely different; the order to check them in is in troubleshooting common errors.

Sources and further reading

Dify’s features and interface change between versions, so check the official docs before you follow any steps:

Further reading

Want someone to build it for you?

If you would rather not put all of this together yourself, or the project is big enough that you want someone to help plan it, Roamer Tech (RoamerHost’s parent company) takes on contract work for business process automation and AI agents:

Ready to get started with Dify?

60 seconds after you subscribe, Dify is installed for you — an isolated container with hard resource limits you never share, and HTTPS out of the box.

Subscribe to Dify

Billed monthly · no contract · cancel anytime

Hi, I'm Roamer! Tap me anytime with a question and I'll help you out.

Roamer

Roamer - AI assistant

Online
Roamer

Ask me anything, anytime — I'll do my best to help!

Powered by RoamerHost AI