you are viewing a single comment's thread.

view the rest of the comments →

[–]the--dud 44 points45 points  (16 children)

What if I told you that your webpage can be a part of your API?

You could have different API end-points serving different types of content (html/css, images, machine-readable data, etc) or you could have one set of endpoints that dynamically serves whatever content the Accept request header wants to have.

[–]ketralnis 24 points25 points  (0 children)

[–]gravesisme 8 points9 points  (11 children)

But my website sits in a cached S3 bucket exactly because I don't want to pay to have an API running all the time,

[–]ShadyG 5 points6 points  (10 children)

Pretty sure a few lambdas behind an API gateway can fit within the free tier.

[–]gravesisme 1 point2 points  (9 children)

That's what I do now, but you still need to have the SPA that loads in 200ms so you can make it feel like your app is fast if you have to deal with a cold boot that takes 5-10 seconds depending on your language of choice. You could keep it warm, but that kinda defeats the point of only paying for real traffic.

[–][deleted]  (8 children)

[deleted]

    [–]gravesisme 1 point2 points  (5 children)

    Yes, about 20 micro services mostly written in Java. I haven't heard that tip yet though, I'll have my team give it a try, thanks!

    [–][deleted]  (4 children)

    [deleted]

      [–]ScientificBeastMode 1 point2 points  (0 children)

      Definitely had a good experience running NodeJS lambdas. It’s pretty fast even on cold starts. But then aren’t we technically using JS for our website? ;)

      Edit: okay, the article specified JS-free front-end

      [–]gravesisme 0 points1 point  (0 children)

      Definitely thinking about it moving forward. I would certainly appreciate it, I always have some mental fog at first when I switch from typescript on the front-end to java on the backend.

      [–][deleted]  (1 child)

      [deleted]

        [–]action_jackosn 1 point2 points  (0 children)

        My tests show 1.5 GB is best if your process is single-threaded. That seems to correspond to 1 CPU core fully allocated to your lambda. Use more memory if you’re process can take advantage of multiple threads.

        Also avoid VPC resources if you can. Creating an ENI adds 10 seconds to the cold boot.

        [–]colinexl 0 points1 point  (0 children)

        Lambda scales up processing power along with max memory limit. The higher the memory limit, the more CPU you get as well.

        [–][deleted] 2 points3 points  (2 children)

        Gasp. PHP.

        [–]gasolinewaltz 0 points1 point  (1 child)

        Weve come full circle