Register a udf module by using java: how long does it take?

Hi all, I’m writing a program in java and I used a udf module. This module is aim to update a record. I want to measure time for executing that. But I see that, step of register take about 1s while update value of record takes less time? This result is correct or not? any reason for that?

Thanks all.

Registering a UDF is a low priority operation for the server, so it depends on how busy it is. It also depends on how many nodes you have as well, since the module gets copied to all of the nodes.

Why would you time it as part of running the UDF, though? You register a UDF module once, and you should do it through a utility like AQL not as part of your production code. You should time how long it takes to execute that code.

Hi rbotzer, I want to time it because my program should work in a short time (millisecond). At the beginning, I do not use UDF, it takes about 500 ms. But when I use it by adding java code like: client.register(null, “udf/example.lua”, “example.lua”, Language.LUA); And my program takes more than 1s (or greater) to finish. So, I doubt this step take longer than the other.

Relating to AQL, you mean I can register first by AQL and I do not need register in java client?

Understand that measuring how long it takes you to register a UDF and also run code doesn’t make sense. It’s like trying to measure how long it takes to build an index and run a query. Registering a UDF that you’ve debugged and tested is something you do in production once.

What will change is how long it takes to run the UDF by itself. Aerospike uses a LuaJIT version, which will progressively compile the Lua, as it runs it.

Yes, you can register a UDF through AQL or any other client.

thanks so much rbotzer!

© 2015 Copyright Aerospike, Inc. | All rights reserved. Creators of the Aerospike Database.