It depends on the sizes of your articles and your glossary 🙂
I wouldn't do this every time someone requests a page though. Likely to take too long, unless you have a lot of iron at your disposal.
I'd implement a "publishing" system which would have "source" and "glossary-linked" copies of each file. When a new file is uploaded, or an existing oneis changed, a "glossary-linked" copy would be auto-generated.
Likewise, when the glossary is changed, all "glossary-linked" docs are updated (or all "source" docs are republished).
This approach would mean that your users aren't waiting for the substitutions every time they request a page.