The Mad Kings Banquet has the 8th-level heroes lead a group of allied soldiers in holding the line against a few waves of enemy soldiers. The 3.5 version had 30+ enemies in a wave and 16+ allies. The 5e version uses squads representing 4 soldiers in a cohesive unit. It turns something like this:
GALLO SOLDIER
Medium humanoid (dwarf), lawful neutral
Armor Class 18 (half plate, shield)
Hit Points 37 (5d8 + 15)
Speed 25 ft.
STR DEX CON INT WIS CHA
15 (+2) 13 (+1) 16 (+3) 10 (+0) 12 (+1) 6 (-2)
Damage Resistances poison
Senses darkvision 60 ft., passive Perception 10
Languages Common, Dwarvish
Challenge 1 (200 XP)
Dwarven Resilience. The dwarf has advantage on saving throws against poison.
ACTIONS
Multiattack. The soldier makes two melee attacks.
Battleaxe. Melee Weapon Attack: +4 to hit, reach 5 ft., one target. Hit: 6 (1d8 + 2) slashing damage, or 7 (1d10 + 2) slashing damage if used with two hands.
Bohemian Earspoon. Melee Weapon Attack: +4 to hit, reach 10 ft., one target. Hit: 7 (2d4 + 2) piercing damage.
Heavy Crossbow. Ranged Weapon Attack: +3 to hit, range 100/400 ft., one target. Hit: 6 (1d10 + 1) piercing damage.
Into this:
SQUAD OF GALLO SOLDIERS
Huge squad of Medium humanoids (dwarf), lawful neutral
Armor Class 18 (half plate, shield)
Hit Points 76 (8d12 + 24)
Speed 25 ft.
STR DEX CON INT WIS CHA
15 (+2) 13 (+1) 16 (+3) 10 (+0) 12 (+1) 6 (-2)
Damage Resistances poison; bludgeoning, slashing, piercing
Condition Immunities charmed, frightened, grappled, paralyzed, petrified, prone, restrained, stunned
Senses darkvision 60 ft., passive Perception 11
Languages Common, Dwarvish
Challenge 5 (1,800 XP)
Dwarven Resilience. The squad has advantage on saving throws against poison.
Squad. The squad can occupy another creature’s space and vice versa, and the squad can move through any opening large enough for a Medium humanoid. The squad can’t regain hit points or gain temporary hit points, and it has advantage on saving throws if the area affected does not cover at least half of the squad’s space.
ACTIONS
Flails. Melee Weapon Attack: +4 to hit, reach 0 ft., one target in the squad’s space. Hit: 36 (8d8) bludgeoning damage, or 18 (4d8) bludgeoning damage if the squad has half of its hit points or fewer.
Bohemian Earspoons. Melee Weapon Attack: +4 to hit, reach 5 ft., one target. Hit: 40 (16d4) piercing damage, or 20 (8d4) piercing damage if the squad has half of its hit points or fewer. The squad has disadvantage when attacking a target within its space.
Bohemian earspoons are pole arm weapons that turns a hit into a critical hit if the creature readies an action to attack an enemy that comes into range. The squad represents 4 soldiers, but the hit points are only twice that of a normal creature because of the damage resistances. The damage of all 4 soldiers attacks are rolled into a single attack. This can make things very dangerous when they hit, especially against a 9th-level PC.
In practice, moving the scenario to squads for the 5e version made the battlefield encounters manageable, but the heroes still had to rely on their allied squads (like the one above) to absorb the damage because a direct confrontation with one or more of the enemy squads was really risky. The enemy waves also had single-unit "heroes" for the PCs to fight, and the PCs could also reinforce parts of the line that buckled.
For your scenario, 3 of the above squads per PC (or ally) would make for a deadly encounter that used up almost all of the daily XP budget for the PCs. If you took the squad concept for the PCs to hold off hundreds of units, you just say that each squad represents 200 soldiers / # of squads = # of soldiers per squad. Other squads such as knights or archers (with an AoE volley attack) will keep all of the units from seeming the same. Having waves will help you gauge how much the heroes can take at a time without overwhelming the heroes instantly.
This will still not be enough to make it a super fast encounter, but it is essentially vanilla D&D and can be spiced up with the great suggestions in the thread, and it has a decent chance of pushing the PCs to their limits..