[{"data":1,"prerenderedAt":137},["ShallowReactive",2],{"content-paved-path-lift-and-shift-a-web-app-to-serverless-11-performance-analysis":3},{"markdown":4,"frontMatterAttributes":5,"bodyRaw":9,"contributorPaths":10,"menuType":12,"contentName":13,"slug":14,"readingTime":15,"menu":16,"nextDocItem":124,"previousDocItem":111},"\u003Cp>After you migrate the application, you can run a page speed insight tool to measure this application’s performance. This tool provides results mostly about the front end and the experience that the user perceives. The results are displayed in the following image. The performance of this website is good, according to the insight tool performance score - it responds quickly and the user experience is good.\u003C\u002Fp>\n\u003Cimg src=\"\u002Fassets\u002Fexternal\u002Fpaved-path\u002Flift-and-shift-a-web-app-to-serverless\u002Fassets\u002Fperformance.png\"\u002F>\n\n\u003Cp>After the application is migrated to a serverless environment, you can do some refactoring to improve further the overall performance. One alternative is whenever a new image is uploaded, it gets resized and formatted into the correct next-gen format automatically using the event driven capabilities that S3 provides. Another alternative is to use \u003Ca href=\"https:\u002F\u002Faws.amazon.com\u002Flambda\u002Fedge\u002F\">Lambda@Edge\u003C\u002Fa> to serve the right image size for the device, as it is possible to format the images on the fly when serving them from a distribution.\u003C\u002Fp>\n\u003Cp>You can run load tests for understanding how your backend and database will perform. For this, you can use \u003Ca href=\"https:\u002F\u002Fwww.artillery.io\u002F\">Artillery\u003C\u002Fa>, an open-source library that allows you to run load tests. You can run tests with the expected maximum load your site will get and ensure that your site can handle it.\u003C\u002Fp>\n\u003Cp>For example, you can configure a test that sends 30 requests per seconds to see how your application reacts:\u003C\u002Fp>\n\u003Cpre>\u003Ccode class=\"language-sh\">config:\n  target: &#39;https:\u002F\u002Fxxx.lambda-url.eu-west-1.on.aws&#39;\n  phases:\n    - duration: 240\n      arrivalRate: 30\n      name: Testing\nscenarios:\n  - name: &#39;Test main page&#39;\n    flow:\n      - post:\n          url: &#39;\u002Fapi\u002Fproduct\u002FgetProducts\u002F&#39;\n\u003C\u002Fcode>\u003C\u002Fpre>\n\u003Cp>Check \u003Ca href=\"https:\u002F\u002Fwww.youtube.com\u002Fwatch?v=B0pDPSQcAf4\">this video\u003C\u002Fa> at the top to run these tests.\u003C\u002Fp>\n\u003Cp>This test is performed on the backend APIs, not only testing your backend but also your integration with the MongoDB. After running it, you can see how the Lambda function performs on the \u003Ca href=\"https:\u002F\u002Faws.amazon.com\u002Fcloudwatch\u002F\">Amazon CloudWatch\u003C\u002Fa> dashboard.\u003C\u002Fp>\n\u003Cp>\u003Ca href=\"https:\u002F\u002Fwww.youtube.com\u002Fwatch?v=0VNKHIcQ5wk\">This video\u003C\u002Fa> explains how to create this dashboard.\u003C\u002Fp>\n\u003Chr>\n\u003Cp>Running this load test helps you understand the limitations of your system. For example, if you run a test with too many concurrent users, you might see that the number of throttles in your function increases. This means that you need to lift the limit of your functions&#39; concurrent invocations (how many invocations you can have at the same time).\u003C\u002Fp>\n\u003Cp>Or when increasing the requests per second, you may find that the MongoDB cluster starts throttling your requests. This is because you are using the free tier which has a set number of connections. You might need a larger cluster or to migrate your database to another service that provides a large free tier, like Amazon DynamoDB.\u003C\u002Fp>\n\u003Cimg src=\"\u002Fassets\u002Fexternal\u002Fpaved-path\u002Flift-and-shift-a-web-app-to-serverless\u002Fassets\u002Fdashboard.png\"\u002F>\n",{"title":6,"order":7,"youtubeVideoID":8},"Performance analysis",13,"B0pDPSQcAf4","After you migrate the application, you can run a page speed insight tool to measure this application’s performance. This tool provides results mostly about the front end and the experience that the user perceives. The results are displayed in the following image. The performance of this website is good, according to the insight tool performance score - it responds quickly and the user experience is good.\n\n\u003Cimg src=\"\u002Fassets\u002Fexternal\u002Fpaved-path\u002Flift-and-shift-a-web-app-to-serverless\u002Fassets\u002Fperformance.png\"\u002F>\n\nAfter the application is migrated to a serverless environment, you can do some refactoring to improve further the overall performance. One alternative is whenever a new image is uploaded, it gets resized and formatted into the correct next-gen format automatically using the event driven capabilities that S3 provides. Another alternative is to use [Lambda@Edge](https:\u002F\u002Faws.amazon.com\u002Flambda\u002Fedge\u002F) to serve the right image size for the device, as it is possible to format the images on the fly when serving them from a distribution.\n\nYou can run load tests for understanding how your backend and database will perform. For this, you can use [Artillery](https:\u002F\u002Fwww.artillery.io\u002F), an open-source library that allows you to run load tests. You can run tests with the expected maximum load your site will get and ensure that your site can handle it.\n\nFor example, you can configure a test that sends 30 requests per seconds to see how your application reacts:\n\n```sh\nconfig:\n  target: 'https:\u002F\u002Fxxx.lambda-url.eu-west-1.on.aws'\n  phases:\n    - duration: 240\n      arrivalRate: 30\n      name: Testing\nscenarios:\n  - name: 'Test main page'\n    flow:\n      - post:\n          url: '\u002Fapi\u002Fproduct\u002FgetProducts\u002F'\n```\n\nCheck [this video](https:\u002F\u002Fwww.youtube.com\u002Fwatch?v=B0pDPSQcAf4) at the top to run these tests.\n\nThis test is performed on the backend APIs, not only testing your backend but also your integration with the MongoDB. After running it, you can see how the Lambda function performs on the [Amazon CloudWatch](https:\u002F\u002Faws.amazon.com\u002Fcloudwatch\u002F) dashboard.\n\n[This video](https:\u002F\u002Fwww.youtube.com\u002Fwatch?v=0VNKHIcQ5wk) explains how to create this dashboard.\n\n---\n\nRunning this load test helps you understand the limitations of your system. For example, if you run a test with too many concurrent users, you might see that the number of throttles in your function increases. This means that you need to lift the limit of your functions' concurrent invocations (how many invocations you can have at the same time).\n\nOr when increasing the requests per second, you may find that the MongoDB cluster starts throttling your requests. This is because you are using the free tier which has a set number of connections. You might need a larger cluster or to migrate your database to another service that provides a large free tier, like Amazon DynamoDB.\n\n\u003Cimg src=\"\u002Fassets\u002Fexternal\u002Fpaved-path\u002Flift-and-shift-a-web-app-to-serverless\u002Fassets\u002Fdashboard.png\"\u002F>\n",[11],"content\u002Fcontributors\u002Fmarcia-villalba.json","LESSON","Lift and shift a web app to serverless","\u002Fcontent\u002Fpaved-path\u002Flift-and-shift-a-web-app-to-serverless\u002F11-performance-analysis","3 min",[17,37,47,55,64,73,82,91,100,109,117,122,130],{"title":18,"content":19},"Introduction",[20],{"title":18,"order":21,"youtubeVideoID":22,"learningGoals":23,"resources":28,"time":33,"path":34,"id":35,"link":36},1,"O-hSs7aF7JE",[24,25,26,27],"Understand what lift and shift migrations are","Understand the benefits of serverless architecture","Learn how to migrate applications and databases from serverful to serverless","Learn patterns for migrating your services onto AWS.",[29],{"link":30,"text":31,"type":32},"https:\u002F\u002Fblog.marcia.dev\u002Flift-and-shift-a-web-app-to-serverless#heading-requirements-for-migration","Lift and shift to Serverless","text","2 min","1-introduction","1-introduction.md","\u002Fcontent\u002Fpaved-path\u002Flift-and-shift-a-web-app-to-serverless\u002F1-introduction",{"title":38,"content":39},"Guide",[40],{"title":41,"order":42,"time":43,"path":44,"id":45,"link":46},"Requirements for migration",2,"1 min","2-requirements-for-migration","2-requirements-for-migration.md","\u002Fcontent\u002Fpaved-path\u002Flift-and-shift-a-web-app-to-serverless\u002F2-requirements-for-migration",{"title":-1,"content":48},[49],{"title":50,"order":51,"time":43,"path":52,"id":53,"link":54},"Application overview",3,"3-application-overview","3-application-overview.md","\u002Fcontent\u002Fpaved-path\u002Flift-and-shift-a-web-app-to-serverless\u002F3-application-overview",{"title":-1,"content":56},[57],{"title":58,"order":59,"youtubeVideoID":60,"time":43,"path":61,"id":62,"link":63},"Database migration",4,"Mic2TGzzVXk","4-database-migration","4-database-migration.md","\u002Fcontent\u002Fpaved-path\u002Flift-and-shift-a-web-app-to-serverless\u002F4-database-migration",{"title":-1,"content":65},[66],{"title":67,"order":68,"youtubeVideoID":69,"time":33,"path":70,"id":71,"link":72},"Backend migration",5,"MvVaFPCdiZY","5-backend-migration","5-backend-migration.md","\u002Fcontent\u002Fpaved-path\u002Flift-and-shift-a-web-app-to-serverless\u002F5-backend-migration",{"title":-1,"content":74},[75],{"title":76,"order":77,"youtubeVideoID":78,"time":33,"path":79,"id":80,"link":81},"Web app migration",6,"gQn4XPfpdZE","6-webapp-migration","6-webapp-migration.md","\u002Fcontent\u002Fpaved-path\u002Flift-and-shift-a-web-app-to-serverless\u002F6-webapp-migration",{"title":-1,"content":83},[84],{"title":85,"order":86,"youtubeVideoID":87,"time":15,"path":88,"id":89,"link":90},"Authentication and authorization migration",7,"KRnZvbVT7uk","7-authentication-and-authorization-migration","7-authentication-and-authorization-migration.md","\u002Fcontent\u002Fpaved-path\u002Flift-and-shift-a-web-app-to-serverless\u002F7-authentication-and-authorization-migration",{"title":-1,"content":92},[93],{"title":94,"order":95,"youtubeVideoID":96,"time":33,"path":97,"id":98,"link":99},"Storage migration",9,"Z4frDpp4PcM","8-storage-migration","8-storage-migration.md","\u002Fcontent\u002Fpaved-path\u002Flift-and-shift-a-web-app-to-serverless\u002F8-storage-migration",{"title":-1,"content":101},[102],{"title":103,"order":104,"youtubeVideoID":105,"time":43,"path":106,"id":107,"link":108},"Testing this application",11,"U_7xD-o5mCA","9-testing-this-application","9-testing-this-application.md","\u002Fcontent\u002Fpaved-path\u002Flift-and-shift-a-web-app-to-serverless\u002F9-testing-this-application",{"title":-1,"content":110},[111],{"title":112,"order":113,"youtubeVideoID":105,"time":33,"path":114,"id":115,"link":116},"How much does this application cost?",12,"10-pricing-of-migrated-application","10-pricing-of-migrated-application.md","\u002Fcontent\u002Fpaved-path\u002Flift-and-shift-a-web-app-to-serverless\u002F10-pricing-of-migrated-application",{"title":-1,"content":118},[119],{"title":6,"order":7,"youtubeVideoID":8,"time":15,"path":120,"id":121,"link":14},"11-performance-analysis","11-performance-analysis.md",{"title":-1,"content":123},[124],{"title":125,"order":126,"time":43,"path":127,"id":128,"link":129},"Conclusion",14,"12-conclusion","12-conclusion.md","\u002Fcontent\u002Fpaved-path\u002Flift-and-shift-a-web-app-to-serverless\u002F12-conclusion",{"title":-1,"content":131},[132],{"title":133,"order":7,"time":43,"path":134,"id":135,"link":136},"Extra resources","13-extra-resources","13-extra-resources.md","\u002Fcontent\u002Fpaved-path\u002Flift-and-shift-a-web-app-to-serverless\u002F13-extra-resources",1792578866352]