theam / aws-lambda-haskell-runtime

⚡Haskell runtime for AWS Lambda
https://theam.github.io/aws-lambda-haskell-runtime/
Other
270 stars 48 forks source link

Allow to store some state between invocations #69

Closed talw closed 4 years ago

talw commented 4 years ago

Are there any plans to allow to store some state in between handler invocations? Like HTTP connections, DB connections and so on?

If not, feel free to close this issue.

At first I thought of adding this ad-hoc using the most quick-and-dirty method I could think of which was dumping the generateLambdaDispatcher output manually, cleaning it up a bit and adding around it the necessary code. However it seems like the required modules are not exported outside of the library (which is understandable). I could take this further and clone the library exporting what is needed, but I'd like to ask whether or not adding this support is on the menu? Or perhaps why this approach is not a good idea and I should try something else?

Looking at https://medium.com/the-theam-journey/benchmarking-aws-lambda-runtimes-in-2019-part-ii-50e796d3d11b I was curious whether or not having state between invocations could improve Haskell's execution and bring it a little bit closer to the other languages in the benchmark. Perhaps you've already benchmarked this but saw no interesting difference?

Any help is greatly appreciated!

dnikolovv commented 4 years ago

Also mentioned in #60. I plan on implementing this after @NickSeagull gives the go signal. Provided nothing in real-life prohibits me (and implementing this is actually possible, because I'm not too familiar with Lambda), we should have this soon.

talw commented 4 years ago

Also mentioned in #60. I plan on implementing this after @NickSeagull gives the go signal. Provided nothing in real-life prohibits me (and implementing this is actually possible, because I'm not too familiar with Lambda), we should have this soon.

Thanks @dnikolovv. Hope you get a reply soon!

NickSeagull commented 4 years ago

Hello! Thanks for pinging me once again!

I answered a little bit about this in this comment.

Let's keep the discussion over there to keep things tidy. Thanks again!