Two plugins that ship with OJS — Recommend Articles by Author and Recommend Similar Articles — redo their entire calculation on every single visit, on the most visited page of any journal. On a client's journal with 4,823 published articles, that cost between 5 and 25 seconds per page. We rewrote both, published the code and, along the way, found a problem in the OJS core itself — which we contributed back to PKP.
The symptom editors recognise
The complaint never arrives as “the plugin is slow”. It arrives as “the journal website feels heavy”, or as the server hitting its CPU ceiling at peak hours. The catch is that the slowness lands exactly where it hurts most: the article page, usually the most visited page of the whole journal and the entry point for readers coming from Google.
Why they are slow
Recommend Articles by Author
On every visit, the plugin asks the database, for each author of the article: “which other authors have this name?”. Author names live in a table whose only key is the author identifier — meaning there is no index to search by name. The database has no choice: it scans the entire table, 401,286 rows, and it does so twice per author (given name and family name).
An article with 32 authors means 64 full scans in a single visit — plus one extra query for every result found.
Recommend Similar Articles
This one runs a full search across the journal on every visit. The cost is not in finding the articles, it is in ranking them: the OJS relevance sorter uses two subqueries that are evaluated once for every candidate article. With 3.4 million rows in the search index, the effort grows quadratically.
The numbers, measured in production
Every measurement below was taken by us, in August 2026, on OJS 3.5 with PHP 8.2 and MariaDB 11.4.
Before
- Recommend by Author, article with 32 authors: 11.9 s and 1,441 database queries.
- Recommend by Author, average over 25 articles: 0.80 s and 183 queries.
- Similar Articles, average over 25 articles: 8.0 s.
- Similar Articles, worst case measured: 22.5 s.
After
- Recommend by Author: 16.6 ms on the first visit, 0.14 ms once the cache is warm.
- Similar Articles: 50.8 ms on the first visit, 0.11 ms once the cache is warm.
- The whole article page, with both sections enabled: 0.285 s.
Rebuilding everything from scratch takes 12 seconds for the author plugin and 196 seconds for the similarity one, across all 4,823 articles. The old way, the similarity plugin would have consumed roughly 29 hours of CPU time. The new tables cost 59 MB on disk, and no OJS table is modified — uninstalling means simply dropping them.
What we did
There is a single idea behind it: the article page no longer calculates anything, it only reads. Three pieces make that work:
- The rendered HTML of the section is cached.
- The list of recommended articles is materialised in a table, ready to be read straight by key.
- A scheduled task recalculates one slice per run — 250 articles every 15 minutes, oldest first.
That third piece is the one usually missing. Caching is the easy part; the hard part is refreshing the cache without taking the site down. If everything expired at once, the refresh would become exactly the stampede caching exists to prevent. Here nothing expires together: the window rolls gradually. And the default behaviour is safe — an article not yet calculated simply does not show the section, instead of making the reader wait for the calculation.
Slowness that produced wrong results
We compared, article by article, the new result against the original plugin across 60 submissions. The new result is a superset: we lost nothing the original found, and gained what it was missing.
- Names with dirty spacing. The original compares exact text, so a name stored with a double space becomes, to it, a different person. That is a mundane and very common problem in any real database.
- ORCID. An author who changed their family name is still the same person. We use ORCID alongside the name, never instead of it — so switching it on can only add articles, never remove them.
- The same name written in different scripts or languages.
And there is the case that best sums up the problem. The original plugin looks for articles by authors with no name at all by comparing one empty name with another — and so it matches every nameless author in the database with every other one. In this journal there are 222 authors with no name, across 97 published articles. Each of those articles was receiving about 3,285 irrelevant recommendations, at a cost of some 100 seconds per view. So it was not merely slow — it was slow in order to produce the wrong answer.
The fix we contributed back to OJS
Before offering our plugins, we tested a simple hypothesis: what if most of the problem is just a missing index? We created the missing index on the author data table and measured the original plugin, without changing a single line of its code:
- Database execution plan: from a scan of 401,286 rows to reading 443 rows.
- Article with 32 authors: from 12.6 s to 0.57 s.
- Article with 21 authors: from 6.4 s to 0.15 s.
- Average over 25 articles: from 0.80 s to 0.07 s.
The index took 0.9 seconds to create. In other words: three lines in the OJS core solve most of the problem for everyone — including journals that never enable the plugin, since any author-name lookup benefits. There is even precedent in the OJS code itself, where another table already carries exactly such an index.
The most valuable fix we found, then, was not in our own code: it was in the core. We submitted it to PKP as pkp-lib#13174 and ojs#5743, and documented the measurements in the two discussions already open on the subject — since 2020 and since 2024.
It is worth saying that none of this is anyone's fault: these are design decisions from ten years ago meeting databases that have grown a great deal since. PKP has acknowledged the problems publicly for years, and one of its developers left an explicit invitation in the 2023 discussion: “in case you get it fixed, feel free to contribute”. That is what we did.
The plugins are public
Both rewritten versions are on our GitHub, under GPL-3.0, with a ready-to-install package:
Both credit, at the top of the README, the Public Knowledge Project, Simon Fraser University and John Willinsky as the original authors — we adapted, we did not invent. Each ships three test suites, all green before publication: regression against a real database (62 cases for the author plugin, 34 for similarity), 36 unit tests with 54 assertions, 14 functional tests in a real browser, and continuous integration running on PHP 8.2 and 8.3. One test deserves a mention: it runs the original slow query and compares its result with ours — proof that we changed the cost without changing the answer.
Which OJS version you run
- In OJS 3.6, PKP replaced the entire search mechanism. Our rewrite of Similar Articles therefore applies to versions 3.4 and 3.5.
- The Recommend by Author problem, however, is unchanged in 3.6 — we checked the code and the index still is not there. That is why we opened the PR against the main branch.
- PKP considers the slow search resolved in 3.6 and advises that, on earlier versions, each installation treat it as a local modification. Since virtually everyone is on 3.4 or 3.5 today, that is exactly where our version helps.
What to do if your journal is slow
If your OJS has these two plugins enabled and the article page is slow to open, you already know where to start looking. The test is quick: disable both and compare how long the same page takes to load. If the difference is glaring, this is your problem — and it has a solution, without giving up the feature.