Our Java backend application is responsible for sending millions of push notifications. However, we are encountering an issue where thousands of connection resets occur daily. This irony leads to an inability to keep up with the volume, resulting in a lag that affects real-time performance.
The application is built on Java, utilizing JDK 1.8 and the Apache HttpClient for network communications. Below is the Maven dependency we use:
XML
<dependency> <groupId>org.apache.httpcomponents</groupId> <artifactId>httpclient</artifactId> <version>4.5.14</version> </dependency>
Additionally, we employ Spring’s RestTemplate to dispatch push notifications. Here is a snippet of the pseudo-code used to call the Apple Push Notification service (APNs):
Java
ResponseEntity<T> postForEntity = restTemplate.postForEntity(apnsURL, entity, responseType); getResponse(aPNSResponse, postForEntity); AI-generated code. Review and use carefully. More info on FAQ. It’s important to note that our calls to APNs are not made directly but are routed through an F5 load balancer, which then communicates with the APNs endpoint.
Could someone guide us in the right direction to resolve these connection reset issues?