Performance of using UDF in real time transactions

I have a real-time system (on average. 20,000 r/s), and in each request, I need to implement some business logic that is not achievable by the standard C# Client API functions (Get, Put…etc), so I was thinking to write the logic in a Record UDF using LUA language but i don’t know how the performance will be?

Any Advice in this? and is it a good design to use LUA in real time transactions?

If the complexity is purely on computation and the amount of data going across the wire not large, then scaling out the on the client side should be the best solution.

However, if one is doing a check-and-set operation, or the data is large and computation small, bringing the computation to the db side can give overall performance improvement.