A transaction may set the maximum number of compute units it is allowed to consume and the compute unit price by including a SetComputeUnitLimit and a SetComputeUnitPrice Compute budget instructions respectively.
If no SetComputeUnitLimit is provided the limit will be calculated as the product of the number of instructions in the transaction (excluding the Compute budget instructions) and the default per-instruction units, which is currently 200k.
Estimating
Calculating Solana Fees
How are Solana transaction fees calculated?
Priority
An additional fee user can specify in the compute budget instruction to prioritize their transactions.
The prioritization fee is calculated by multiplying the requested maximum compute units by the compute-unit price (specified in increments of 0.000001 lamports per compute unit) rounded up to the nearest lamport.
Transactions should request the minimum amount of compute units required for execution to minimize fees.
Usage
Compute Budget instructions don't require any accounts and don't consume any compute units to process. Transactions can only contain one of each type of compute budget instruction, duplicate types will result in an error.
You can set the compute unit limit and unit price by calling the compute budget program. you can do so by using the Solana web3js library
https://solana-labs.github.io/solana-web3.js/classes/ComputeBudgetProgram.html
How to pick the fee
In general, it's hard to know what fee to pick in order to get your transaction processed first. You can use a higher fee than the daily average transaction fee.
This might be useful to use
https://solanabeach.io/transactions
https://solanacompass.com/statistics/fees