Re: Clojure on AWS Lambda?

2015-07-05 Thread Moe Aboulkheir
I looked into this a little over the weekend, and wrote a small library 
lein template/plugin for deploying Clojurescript functions to Lambda:
https://github.com/nervous-systems/cljs-lambda

There's a blog post / step-by-step tutorial here:
https://nervous.io/clojure/clojurescript/aws/lambda/node/lein/2015/07/05/lambda/

Take care,
Moe

On Wed, Jun 17, 2015 at 8:28 AM, Ragnar Dahlén r.dah...@gmail.com wrote:

 You can get the initial startup time down by AOT compiling. I also believe
 that Lambda will re-use the same runtime and lambda function instance until
 a certain period of inactivity.

 For example, in the example below I invoke the function (AOT compiled this
 time) three times. First invocation takes ~7s, the two following ~1.5ms.


 START RequestId: b555c9c2-14c1-11e5-8a31-03153568534c
 HELLO FROM CLOJURE :)
 #object[lambdainternal.api.LambdaClientContext 0x3419866c
 lambdainternal.api.LambdaClientContext@3419866c]
 END RequestId: b555c9c2-14c1-11e5-8a31-03153568534c
 REPORT RequestId: b555c9c2-14c1-11e5-8a31-03153568534c Duration: 7882.62
 ms Billed Duration: 7900 ms Memory Size: 512 MB Max Memory Used: 98 MB
 START RequestId: bd876a51-14c1-11e5-94fc-f9606cb38b63
 HELLO FROM CLOJURE :)
 #object[lambdainternal.api.LambdaClientContext 0x63e31ee
 lambdainternal.api.LambdaClientContext@63e31ee]
 END RequestId: bd876a51-14c1-11e5-94fc-f9606cb38b63
 REPORT RequestId: bd876a51-14c1-11e5-94fc-f9606cb38b63 Duration: 1.66 ms
 Billed Duration: 100 ms Memory Size: 512 MB Max Memory Used: 98 MB
 START RequestId: bdf4aa6f-14c1-11e5-a6b0-e9e3f6fa14c8
 HELLO FROM CLOJURE :)
 #object[lambdainternal.api.LambdaClientContext 0x68fb2c38
 lambdainternal.api.LambdaClientContext@68fb2c38]
 END RequestId: bdf4aa6f-14c1-11e5-a6b0-e9e3f6fa14c8
 REPORT RequestId: bdf4aa6f-14c1-11e5-a6b0-e9e3f6fa14c8 Duration: 1.56 ms
 Billed Duration: 100 ms Memory Size: 512 MB Max Memory Used: 98 MB


 On Tuesday, 16 June 2015 16:46:36 UTC+1, Kyle Sexton wrote:

 Answering my own question about performance, it looks like almost 14
 seconds for the Lambda function to run. Doing the math1
 #14e006bc5690cdbe_m2mvzzr704.fsf@mocker.org_fn.1 if I were to run this
 300 times in a month bill would be about $342.56. Probably not the
 ideal solution for clojure in the cloud just yet. :)

 START RequestId: 48614bcd-143b-11e5-b2c5-b704df8ab2eb
 HELLO FROM CLOJURE :)
 #object[lambdainternal.api.LambdaClientContext 0x26a7b76d 
 lambdainternal.api.LambdaClientContext@26a7b76d]
 END RequestId: 48614bcd-143b-11e5-b2c5-b704df8ab2eb
 REPORT RequestId: 48614bcd-143b-11e5-b2c5-b704df8ab2eb   Duration: 
 13680.53 ms   Billed Duration: 13700 ms   Memory Size: 512 MB Max 
 Memory Used: 104 MB

  Kyle Sexton

 Footnotes:
  Footnotes:
 1 #14e006bc5690cdbe_m2mvzzr704.fsf@mocker.org_fnr.1

 Used http://aws.amazon.com/lambda/pricing/ and came up with (* (* (*
 13.7 300) (/ 512 1024.0)) 0.1667) where 300 is number of
 times run per month, 13.7 is seconds of billable time, 512 is MB of RAM
 allocated to the function.

  --
 You received this message because you are subscribed to the Google
 Groups Clojure group.
 To post to this group, send email to clojure@googlegroups.com
 Note that posts from new members are moderated - please be patient with
 your first post.
 To unsubscribe from this group, send email to
 clojure+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/clojure?hl=en
 ---
 You received this message because you are subscribed to the Google Groups
 Clojure group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to clojure+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/d/optout.


-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ANN] lambada - using clojure with AWS Lambda

2015-06-17 Thread Ragnar Dahlén
Hi,

I've just released lambada, a tiny library that provides a way to write AWS 
Lambda [1] functions in clojure:

https://github.com/uswitch/lambada

The slightly tricky part with using clojure on Lambda was getting the 
clojure runtime to load classes using the correct class loader and this 
library solves that problem, and provides a simple macro to generate named 
classes that can be used as Lambda handlers.

Cheers,

Ragnar 


[1]: http://docs.aws.amazon.com/lambda/latest/dg/welcome.html

-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Clojure on AWS Lambda?

2015-06-17 Thread Ragnar Dahlén
You can get the initial startup time down by AOT compiling. I also believe 
that Lambda will re-use the same runtime and lambda function instance until 
a certain period of inactivity.

For example, in the example below I invoke the function (AOT compiled this 
time) three times. First invocation takes ~7s, the two following ~1.5ms.


START RequestId: b555c9c2-14c1-11e5-8a31-03153568534c
HELLO FROM CLOJURE :)
#object[lambdainternal.api.LambdaClientContext 0x3419866c 
lambdainternal.api.LambdaClientContext@3419866c]
END RequestId: b555c9c2-14c1-11e5-8a31-03153568534c
REPORT RequestId: b555c9c2-14c1-11e5-8a31-03153568534c Duration: 7882.62 ms 
Billed Duration: 7900 ms Memory Size: 512 MB Max Memory Used: 98 MB
START RequestId: bd876a51-14c1-11e5-94fc-f9606cb38b63
HELLO FROM CLOJURE :)
#object[lambdainternal.api.LambdaClientContext 0x63e31ee 
lambdainternal.api.LambdaClientContext@63e31ee]
END RequestId: bd876a51-14c1-11e5-94fc-f9606cb38b63
REPORT RequestId: bd876a51-14c1-11e5-94fc-f9606cb38b63 Duration: 1.66 ms 
Billed Duration: 100 ms Memory Size: 512 MB Max Memory Used: 98 MB
START RequestId: bdf4aa6f-14c1-11e5-a6b0-e9e3f6fa14c8
HELLO FROM CLOJURE :)
#object[lambdainternal.api.LambdaClientContext 0x68fb2c38 
lambdainternal.api.LambdaClientContext@68fb2c38]
END RequestId: bdf4aa6f-14c1-11e5-a6b0-e9e3f6fa14c8
REPORT RequestId: bdf4aa6f-14c1-11e5-a6b0-e9e3f6fa14c8 Duration: 1.56 ms 
Billed Duration: 100 ms Memory Size: 512 MB Max Memory Used: 98 MB


On Tuesday, 16 June 2015 16:46:36 UTC+1, Kyle Sexton wrote:

 Answering my own question about performance, it looks like almost 14 
 seconds for the Lambda function to run. Doing the math1 
 #m2mvzzr704.fsf@mocker.org_fn.1 if I were to run this 300 times in 
 a month bill would be about $342.56. Probably not the ideal solution for 
 clojure in the cloud just yet. :)
  
 START RequestId: 48614bcd-143b-11e5-b2c5-b704df8ab2eb
 HELLO FROM CLOJURE :)
 #object[lambdainternal.api.LambdaClientContext 0x26a7b76d 
 lambdainternal.api.LambdaClientContext@26a7b76d]
 END RequestId: 48614bcd-143b-11e5-b2c5-b704df8ab2eb
 REPORT RequestId: 48614bcd-143b-11e5-b2c5-b704df8ab2ebDuration: 
 13680.53 ms   Billed Duration: 13700 ms   Memory Size: 512 MB Max 
 Memory Used: 104 MB

  Kyle Sexton
  
 Footnotes:
  Footnotes: 
 1 #m2mvzzr704.fsf@mocker.org_fnr.1 

 Used http://aws.amazon.com/lambda/pricing/ and came up with (* (* (* 13.7 
 300) (/ 512 1024.0)) 0.1667) where 300 is number of times run 
 per month, 13.7 is seconds of billable time, 512 is MB of RAM allocated to 
 the function.
  

-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Clojure on AWS Lambda?

2015-06-16 Thread Ragnar Dahlén
I gave it a go:
https://github.com/uswitch/lambada

It's just a POC. Needed a Java shim to manage class loaders so the 
interface is not as nice I was hoping.

Might make it into library if there's interest.


On Monday, 15 June 2015 21:07:29 UTC+1, Kyle Sexton wrote:

 Curious if anyone is doing anything on AWS Lambda now that it supports 
 running Lambda functions in Java, 
 https://aws.amazon.com/blogs/aws/aws-lambda-update-run-java-code-in-response-to-events/
  
 ? 


 Kyle Sexton 


-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Clojure on AWS Lambda?

2015-06-16 Thread Kyle Sexton
Answering my own question about performance, it looks like almost 14 seconds 
for the Lambda function to run.  Doing the math[fn:1] if I were to run this 
300 times in a month bill would be about $342.56.  Probably not the ideal 
solution for clojure in the cloud just yet. :)


#+BEGIN_EXAMPLE
START RequestId: 48614bcd-143b-11e5-b2c5-b704df8ab2eb
HELLO FROM CLOJURE :)
#object[lambdainternal.api.LambdaClientContext 0x26a7b76d 
lambdainternal.api.LambdaClientContext@26a7b76d]
END RequestId: 48614bcd-143b-11e5-b2c5-b704df8ab2eb
REPORT RequestId: 48614bcd-143b-11e5-b2c5-b704df8ab2eb  Duration: 13680.53 ms   
Billed Duration: 13700 ms   Memory Size: 512 MB Max Memory Used: 104 MB 
#+END_EXAMPLE


Kyle Sexton

Footnotes:

[fn:1] Used [[http://aws.amazon.com/lambda/pricing/]] and came up with =(* (* 
(* 13.7 300) (/ 512 1024.0)) 0.1667)= where 300 is number of times 
run per month, 13.7 is seconds of billable time, 512 is MB of RAM allocated to 
the function.

-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Clojure on AWS Lambda?

2015-06-16 Thread Kyle Sexton
Nice work!  Can you give any indication of what performance is like?


Kyle Sexton

Ragnar Dahlén r.dah...@gmail.com writes:

 I gave it a go:
 https://github.com/uswitch/lambada

 It's just a POC. Needed a Java shim to manage class loaders so the
 interface is not as nice I was hoping.

 Might make it into library if there's interest.

 On Monday, 15 June 2015 21:07:29 UTC+1, Kyle Sexton wrote:

 Curious if anyone is doing anything on AWS Lambda now that it
 supports running Lambda functions in Java,
 
 https://aws.amazon.com/blogs/aws/aws-lambda-update-run-java-code-in-response-to-
events/ ? 
 
 
 Kyle Sexton 

-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Clojure on AWS Lambda?

2015-06-16 Thread Karsten Schmidt
Maybe Clojure itself isn't suitable, but Clojurescript w/ node as
target and lein-npm[1] should be okay (not tested)... Alternatively,
if you really need JVM features, you might be able to give Skummet[2]
a try (and please report back!)

[1] https://github.com/RyanMcG/lein-npm
[2] http://clojure-android.info/skummet/

On 16 June 2015 at 01:46, Jason Lewis ja...@decomplecting.org wrote:
 I'm actually really curious about this as well, I've been wanting to
 experiment with AWS Lambda but the slow start-up of the Clojure runtime on
 the JVM has made me apprehensive... is there some mitigation of this on the
 Lambda service?

 On Mon, Jun 15, 2015 at 4:07 PM Kyle Sexton k...@mocker.org wrote:

 Curious if anyone is doing anything on AWS Lambda now that it supports
 running Lambda functions in Java,
 https://aws.amazon.com/blogs/aws/aws-lambda-update-run-java-code-in-response-to-events/
 ?


 Kyle Sexton

 --
 You received this message because you are subscribed to the Google
 Groups Clojure group.
 To post to this group, send email to clojure@googlegroups.com
 Note that posts from new members are moderated - please be patient with
 your first post.
 To unsubscribe from this group, send email to
 clojure+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/clojure?hl=en
 ---
 You received this message because you are subscribed to the Google Groups
 Clojure group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to clojure+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/d/optout.

 --
 You received this message because you are subscribed to the Google
 Groups Clojure group.
 To post to this group, send email to clojure@googlegroups.com
 Note that posts from new members are moderated - please be patient with your
 first post.
 To unsubscribe from this group, send email to
 clojure+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/clojure?hl=en
 ---
 You received this message because you are subscribed to the Google Groups
 Clojure group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to clojure+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/d/optout.



-- 
Karsten Schmidt
http://postspectacular.com | http://thi.ng | http://toxiclibs.org

-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Clojure on AWS Lambda?

2015-06-15 Thread Jason Lewis
I'm actually really curious about this as well, I've been wanting to
experiment with AWS Lambda but the slow start-up of the Clojure runtime on
the JVM has made me apprehensive... is there some mitigation of this on the
Lambda service?

On Mon, Jun 15, 2015 at 4:07 PM Kyle Sexton k...@mocker.org wrote:

 Curious if anyone is doing anything on AWS Lambda now that it supports
 running Lambda functions in Java,
 https://aws.amazon.com/blogs/aws/aws-lambda-update-run-java-code-in-response-to-events/
 ?


 Kyle Sexton

 --
 You received this message because you are subscribed to the Google
 Groups Clojure group.
 To post to this group, send email to clojure@googlegroups.com
 Note that posts from new members are moderated - please be patient with
 your first post.
 To unsubscribe from this group, send email to
 clojure+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/clojure?hl=en
 ---
 You received this message because you are subscribed to the Google Groups
 Clojure group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to clojure+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/d/optout.


-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Clojure on AWS Lambda?

2015-06-15 Thread Kyle Sexton
Curious if anyone is doing anything on AWS Lambda now that it supports running 
Lambda functions in Java, 
https://aws.amazon.com/blogs/aws/aws-lambda-update-run-java-code-in-response-to-events/
 ?


Kyle Sexton

-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.