I am getting 503 timeout error in my AEM application. The application is getting data from an external system through an AEM servlet and that data is being rendered in UI. The application gets time out if the response time is more than 30 seconds. Is there any specific configuration which is responsible for this timeout.
Solved! Go to Solution.
Views
Replies
Total Likes
Hi,
Every AEM function which reaches out to an external system should be guarded by a timeout, and in most cases a timeout of more than 30 seconds is inadequate and too high; what's the functionality on the other system which takes 30 seconds to response properly?
This gets even more important, if an user makes a request to AEM and AEM in turn makes a request to a different system. The AEM standard timeout is 30 second (which is quite high for an interactive application), so the application on the other system should also respond very quickly, thus a timeout of say 5 seconds is appropriate. Relying on default timeouts is a good way to run a Denial of Service attack against AEM, because if all threads are blocked (waiting on the external system which response very slowly) your AEM doesn't have free threads anymore to handle legitimate requests (which do not require to reach this other system and which could be handled within milliseconds).
So: Do not increase the timeout on AEM side, but rather build your application in a more resilient way.
Ok, understood. But that means that you reconfigure AEM explicitly for this request.
The timeout configuration is a safety measure of every system, which allows it to recover from operations which take too long. If you increase the overall timeout, the loosen this safety net a bit.
In your case you have 2 timeouts to consider:
* The timeout of jetty (the request from user to AEM)
* the timeout of your external request (from AEM to the external system)
You have to increase the timeout of both.
I think you should check the response from external application as well. Could be issue at external point as well.
You can try though -
Apache Felix Jetty Based HTTP Service
Connection Timeout | Time limit for reaching an timeout specified in milliseconds. This property applies to both HTTP and HTTP connections. Defaults to 60 seconds. (org.apache.felix.http.timeout) |
Views
Replies
Total Likes
Hi,
Every AEM function which reaches out to an external system should be guarded by a timeout, and in most cases a timeout of more than 30 seconds is inadequate and too high; what's the functionality on the other system which takes 30 seconds to response properly?
This gets even more important, if an user makes a request to AEM and AEM in turn makes a request to a different system. The AEM standard timeout is 30 second (which is quite high for an interactive application), so the application on the other system should also respond very quickly, thus a timeout of say 5 seconds is appropriate. Relying on default timeouts is a good way to run a Denial of Service attack against AEM, because if all threads are blocked (waiting on the external system which response very slowly) your AEM doesn't have free threads anymore to handle legitimate requests (which do not require to reach this other system and which could be handled within milliseconds).
So: Do not increase the timeout on AEM side, but rather build your application in a more resilient way.
Ok, understood. But that means that you reconfigure AEM explicitly for this request.
The timeout configuration is a safety measure of every system, which allows it to recover from operations which take too long. If you increase the overall timeout, the loosen this safety net a bit.
In your case you have 2 timeouts to consider:
* The timeout of jetty (the request from user to AEM)
* the timeout of your external request (from AEM to the external system)
You have to increase the timeout of both.
Views
Replies
Total Likes
Ok, understood. But that means that you reconfigure AEM explicitly for this request.
The timeout configuration is a safety measure of every system, which allows it to recover from operations which take too long. If you increase the overall timeout, the loosen this safety net a bit.
In your case you have 2 timeouts to consider:
* The timeout of jetty (the request from user to AEM)
* the timeout of your external request (from AEM to the external system)
You have to increase the timeout of both.
Views
Replies
Total Likes
Views
Replies
Total Likes
I just want to highlight a few things
Taking 30second's time is not a good sign, if you are testing this on a lower environment then I feel it is ok to wait for 30 seconds for a response, but if you want to deploy this to the production with the same configuration then it is going to be a problem the end-user will get frustrated and also it is not good user experience.
Check with the people who are managing the external system and get the SLA's, if the external system always behaves like that I mean takes more than 30 seconds then don't rely on that you need to change your approach.
You can write a scheduler which fetches data from the external system and stores in the AEM repository, the component which you want to display external content will read it from your AEM repository.
With this, you will get the best user experience and you do not need to wait for on an external system especially when it is not reliable.
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies