I created an array of a class with a long length, ~ 150M elements, sorted by key (described below). Then I create a simple http server for the feedback of each request as a binary search function in an array. (I'm sure the server is working fine)
Initiating data is just fine (ofcouse is pretty slow). The binary search function is fast as expected.
The problem is that the response is fast for a while (10 minutes, 1 hour ... a lot of time), then the server takes quite a lot of time (several minutes) to execute the binary search function for the request, then quickly back and then slowly after a while ... Although it is slow, I check the server status (htop), it seems that jvm is in GC.
The problem does not arise when I split a large array into smaller ones, for example: 10 arrays of 15M elements, I find the target array before searching. So I think something happens in the JVM when I create an array too large
(Edit: I have no problem splitting a large array into pieces, because I implemented the SiteInfo object for native, the large number of objects in the JVM is reduced. Therefore, the problem caused by too many objects that I created as answers below, thanks to you guys)
Do you guys have any ideas on my problem?
(I sent my code, there are some pseudo codes that I think are not very important)
public static class Token2TopSite implements Comparable<Token2TopSite> { public final String token;
source share