Prioritize traffic on a UDP port

Hello everyone,
I’m currently trying to get to grips with traffic prioritization, but I don’t really understand it. For example, I would like to prioritize the traffic from UDP port 9987 over everything else.

Can someone help me with this and maybe send me a code snippit? I would also be very happy about an explanation.

This is very complicated…

This is what I use to prioritise DHCP, TCP SYN/ACK & DNS Traffic egress on my WAN Interface (eth0.10). You can see how I match DNS (UDP port 53) in class 30.

set qos interface eth0.10 egress 'wan-out'

set qos policy shaper wan-out bandwidth '550mbit'
set qos policy shaper wan-out class 10 bandwidth '1%'
set qos policy shaper wan-out class 10 burst '256k'
set qos policy shaper wan-out class 10 description 'DHCP Traffic'
set qos policy shaper wan-out class 10 match dhcp ip destination port '67'
set qos policy shaper wan-out class 10 match dhcp ip protocol 'udp'
set qos policy shaper wan-out class 10 priority '0'
set qos policy shaper wan-out class 10 queue-limit '16'
set qos policy shaper wan-out class 10 queue-type 'fq-codel'
set qos policy shaper wan-out class 20 bandwidth '3%'
set qos policy shaper wan-out class 20 burst '2mb'
set qos policy shaper wan-out class 20 description 'TCP SYN/ACK'
set qos policy shaper wan-out class 20 match tiny4 ip tcp ack
set qos policy shaper wan-out class 20 match tiny4 ip tcp syn
set qos policy shaper wan-out class 20 priority '1'
set qos policy shaper wan-out class 20 queue-limit '128'
set qos policy shaper wan-out class 20 queue-type 'fq-codel'
set qos policy shaper wan-out class 30 bandwidth '1%'
set qos policy shaper wan-out class 30 burst '1mb'
set qos policy shaper wan-out class 30 description 'DNS Traffic'
set qos policy shaper wan-out class 30 match dns ip destination port '53'
set qos policy shaper wan-out class 30 match dns ip protocol 'udp'
set qos policy shaper wan-out class 30 priority '2'
set qos policy shaper wan-out class 30 queue-limit '128'
set qos policy shaper wan-out class 30 queue-type 'fq-codel'
set qos policy shaper wan-out default bandwidth '95%'
set qos policy shaper wan-out default burst '15k'
set qos policy shaper wan-out default ceiling '100%'
set qos policy shaper wan-out default codel-quantum '8000'
set qos policy shaper wan-out default priority '7'
set qos policy shaper wan-out default queue-type 'fq-codel'
set qos policy shaper wan-out description '550Mbit/s Out via ISP'

I’m using fq-codel to share the bandwidth as well, so one user can’t “steal” all my upload bandwidth.