Serverless PHP is pretty good

Поділитися
Вставка
  • Опубліковано 9 січ 2025

КОМЕНТАРІ • 27

  • @juanpineda-montoya
    @juanpineda-montoya 8 місяців тому +10

    Great video!! for anyone out there: Be mindful of the Lamda serverless cost and the egress costs, they are billed separately

    • @aschmelyun
      @aschmelyun  8 місяців тому +1

      100%, despite the free tier you're still using AWS Gateway and that's billed separately. It can be easy to go over the request limit (or have yourself open to bad actors that slam your website). Usage alerts are a must!

  • @HarshalRinge
    @HarshalRinge 8 місяців тому +2

    We have migrated all sqs job workers from EC2 to Lambda and we are very happy with the result.

    • @JesusEnriqueFrancoMartinez
      @JesusEnriqueFrancoMartinez 4 місяці тому

      On multiple lambda functions or did you created one for each Job? I'm very interested your idea

  • @IfedolapoAjetunmobi
    @IfedolapoAjetunmobi 3 місяці тому

    The more I watch your videos, the more I want to go the PHP route for web development; as I’m a beginner just about finished up with HTML CSS moving to JS

  • @rickybarabba7866
    @rickybarabba7866 8 місяців тому +1

    Thanks for the video. A very interesting one and useful for most of my needs.
    Just a question, maybe a stupid one, since I have used AWS services just to give a try with Laravel Vapor. Suppose I want to connect to an external database (MySQl, Mariadb etc.) that has IP policy in place how do I know the IP address (maybe a pool of IP addresses) to estabilisha a connection outside AWS lambda?

    • @aschmelyun
      @aschmelyun  8 місяців тому +1

      That is an interesting question. I suppose you'd have to either deploy first without that db connection to get the IP address, or maybe AWS (or the Serverless framework) has a way of assigning a set IP before you actually make the deployment that you can configure with your db provider.

  • @jingoo01
    @jingoo01 8 місяців тому

    Sorry that thumb-up button is toggle. I would keep clicking if it is incremental. One question hits me. what should I put for APP_URL? I can get url after deploy.

  • @SXsoft99
    @SXsoft99 8 місяців тому +2

    soooo the bottleneck will still remain "the database connection" since, if my understanding of serverless is correct, let AWS decide when to spawn the server and where automatically but the DB still remain on a fixed point
    but i assume that if you have a presentation website with data that doesn't change that much or use SQLite you will not have a problem
    at least for Laravel apps I don't think this is going to get lots of usage
    also from what I remember doesn't Serveless does auto caching on the execution files while on a traditional stack (i prefer to use nginx instead of Apache) you need to configure OPcache extension on PHP side, and have caching set to Redis for some speed improvement? I don't know if these facts might affect benchmarks.
    Costs might also be a big factor to go the traditional way. If your client doesn't care about this part them yolo.

    • @aschmelyun
      @aschmelyun  8 місяців тому +1

      Valid comments all around. You're right, the db connection is still the weak spot. The cool thing is that you can actually serve a read-only sqlite database with this setup through the Lambda instance. So if you're displaying a mostly-static site you can really ramp up the concurrency and slash response times.
      This is likely overkill for most pet projects, but I do have a few microservices running on this stack that cost practically nothing. Might be easier to build them in Node or Python but I'm just comfortable with PHP (and it's fun!)

    • @SXsoft99
      @SXsoft99 8 місяців тому

      ​@@aschmelyun i also make my bread money using PHP :D
      and yes i do find lamba more at home using JS, but that's mostly because of the JS ecosystem

  • @jit-r5b
    @jit-r5b 8 місяців тому

    I'd actually feel that this benchmark is just a half of the coin. I would like to see the total duration (as a median value) in ms. I say this because I discovered that Laravel paired with modern server such as Swoole outperforms your VPS example by a ten fold.
    This is of course isolating away from all the DX that comes with the "server less" deployments. Coolify is worth a look.

  • @Stoney_Eagle
    @Stoney_Eagle 8 місяців тому +1

    I would love to see a video on how laravel hosts its websites with all the CD CI tools setup 😊

    • @turbokev3772
      @turbokev3772 8 місяців тому +1

      Not with bref. Laravel has it's own serverless offering. It's called Laravel Vapor and it is built for and runs on AWS.

    • @aschmelyun
      @aschmelyun  8 місяців тому +1

      Correct! It's similar in fashion though, they use a custom runtime for Lambda that executes the PHP code. As far as I know it's all proprietary though, so finding out how it works for sure would be pretty tough!

  • @hoguw1
    @hoguw1 8 місяців тому

    Cool video and interesting to see this work that easily. But I am wary of the unpredictable nature of the costs though. Could you say a bit more about this?

    • @aschmelyun
      @aschmelyun  8 місяців тому +1

      It's probably the #1 thing I've seen mentioned in the comments about running PHP (or any language) on Lambda. The best advice I can give is to ensure you have billing notifications set up and be vigilant about monitoring traffic.
      If you can, implement something like Cloudflare as an intermediary to prevent high traffic spikes from DDOS and implement cached responses from specific routes.

  • @timothygithinjithegreat
    @timothygithinjithegreat 8 місяців тому

    great video! what about an application that uses websockets? how do you host those?

    • @aschmelyun
      @aschmelyun  8 місяців тому

      You can use the same method if you want! AWS Gateway allows for WS connections, and the Bref package lets you accept them in your application. There's a whole documentation section for it on their site (although it's a little sparse) bref.sh/docs/use-cases/websockets

  • @gazorbpazorbian
    @gazorbpazorbian 8 місяців тому

    LOVE THIS VIDEO! THANKS!

  • @pwcodigo
    @pwcodigo 8 місяців тому

    Obrigado pelo conteúdo.

  • @kenjohnsiosan9707
    @kenjohnsiosan9707 8 місяців тому +1

  • @leetkhan
    @leetkhan 8 місяців тому

    Am I the only one thinking PHP was already serverless, just upload your code to any hosting via ftp

  • @thisbridgehascables
    @thisbridgehascables 8 місяців тому +1

    This term ‘serverless’ is really stupid because.. a server is still needed somewhere or a computer hosting the necessary packages, language, required software and hardware..
    The language we build around hosting from this to the cloud .. really make zero sense.

    • @aschmelyun
      @aschmelyun  8 місяців тому

      Oh agreed, what's the saying? "The cloud is just someone else's computer"

  • @wrends
    @wrends 8 місяців тому

    it's not needed....