Originally from the User Slack
@Mikael_Hedberg: Hi, I have some questions regarding UDF and WASM. I think it’s a really exciting feature and I had the following use case in mind. Could someone maybe shed some light if this is a good idea or not and if UDFs are really intended for such a use case.
• I store a complex (not big) graph as a serialized object. We have a bunch of operations on that object that can affect many nodes or none (reading the whole thing is a must).
• At the moment we are reading it from scylla, performing the patch on the object and then set it again using LWT (IF condition on etag)
What would be awesome is that if we could simply compile some C or Rust code that performs the patch operations and use it as UDFs inside the DB.
This would for example require that we deserialize a protobuf (or a flatbuffer), perform the algorithms and then update the object.
Would you consider this a good approach? I expect it to greatly reduce the latency since we can get rid of the LWT operation all together and only perform a simple update (possible a read when we need to return the data). Both operations are preferable to LWT. Any thoughts? Are there stable WASM bindings available (i.e. encapsulating the ABI), if so where?
@Piotr_Smaroń: cc @Wojciech_Mitros
@avi: UDFs can’t be used for update-in-place yet; even if they could, they’d have to perform a LWT internally.
@Wojciech_Mitros: Right, currently you can only use them to read the calculated result or aggregate results from many rows using UDAs.
The deserialization and other algorithms should be possible to implement in them - the Rust bindings can be found at https://github.com/scylladb/scylla-rust-udf
Note that they’re still experimental - we haven’t tested them well yet
@Mikael_Hedberg: Great, thanks a lot for your answers.