I found that for a simple transaction, the UsedGas is constant value(i.e. 21000). Can it be modified when sending a transaction or configured somewhere? Thanks.
As @goodvibration mentioned, you can't modify this in the code of a client running publicly. (It'd lead to a protocol mismatch when your client tried to publicly broadcast anything - I think... )
If the scope of your question concerns your own private network, then you can edit the value and rebuild your client code.
The value is defined in protocol_params.go:
TxGas uint64 = 21000 // Per transaction not creating a contract. NOTE: Not payable on data of calls between transactions.
(There's various associated test code that also hard-codes its own value, so you'd want to change those as well for completeness.)
Thinking about this some more, you'd probably want to be careful that changing this doesn't completely screw up your network's gas pricing system, and the relative cost of sending a transaction vs. everything else...
It's unclear exactly what is being asked about here: the amount of gas sent with a transaction or the amount of gas required by it?
The amount of gas sent with a transaction can be modified when building the transaction to announce to the network. For example, if using web3, you can use the "gas" parameter, or when using MetaMask, you can click "Edit" just above the gas fee amount and then click Advanced to set the amount of gas to be included in the transaction.
If you include more than needed, you get the surplus refunded back, but if you include too much more (especially in excess of the dynamic per-block gas limit), miners might be less willing to include it in a block due to the maximum total gas per block.