Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I Optimize Spring Framework usage for Google App Engine Applications

Google App Engine frontend instances are dynamically scaled. That means App Engine automatically creates new instances when load increases and turns off instances when they are not being used. Reloading instances may result in additional latency for users. Frontend instances also have a 60 seconds deadline to complete a given request.

As I am using Spring MVC and Spring IOC in my GAE application, to Optimize Spring Framework usage, I have gone through Best Practices for App Engine Applications.

In that link I am completely confused with the section Reducing or Avoiding the Use of Relationship Autowiring . It says automatic wiring can significantly the time required to resolve the beans during application initialization time, so they suggest autowire byName instead of using autowire byType .

So my question is How autowire byName reduces bean resolving time ?? . And also I would like to know is there any better way to inject beans ?. Is there any best practices for Spring IOC to reduce application initialization time.

like image 649
Jayasagar Avatar asked Nov 23 '13 18:11

Jayasagar


People also ask

Which programming environment is used for Google App Engine?

js, Java, Ruby, C#, Go, Python, or PHP. A fully managed environment lets you focus on code while App Engine manages infrastructure concerns. Use Cloud Monitoring and Cloud Logging to monitor the health and performance of your app and Cloud Debugger and Error Reporting to diagnose and fix bugs quickly.

Does the Spring Framework work with Gae?

Getting Started and Deploying Spring Boot application on Google App Engine (GAE) So spring boot is versatile web framework and pretty much every java developer these days use this and Google app engine or GAE is a Platform as a Service and cloud computing platform for developing and hosting web applications.

How do I deploy spring boot in Google Compute Engine?

Configure Google Cloud Platform Console and SDK. Use Cloud SQL to create a MySQL instance. Configure the application for Spring Cloud GCP. Deploy the application to App Engine and test it.


1 Answers

Autowire "byType" obviously have to use some mechanism (and some processing )to correctly identify the bean whereas using "byName" provide a direct identification.

Take an analogy of a group of many breed of cats and dogs. To find the terrier out of the group you will have to first identify all breeds however when you use name of dogs it is much easier and improve the identification.

Spring does scanning of the classes for annotations which are inside package defined in "context:component-scan" if there are many classes in package it will take a while during start-up of an application hence it is suggested to use autowire byName.

like image 193
apurvc Avatar answered Oct 05 '22 23:10

apurvc