Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Collect stats about message sizes in JITServer #9708

Closed
mpirvu opened this issue May 27, 2020 · 9 comments
Closed

Collect stats about message sizes in JITServer #9708

mpirvu opened this issue May 27, 2020 · 9 comments
Labels
comp:jitserver Artifacts related to JIT-as-a-Service project

Comments

@mpirvu
Copy link
Contributor

mpirvu commented May 27, 2020

The goal is to determine which messages are larger and whether such messages can be reduced in size. For instance, the message that sends the compilation request is probably on the large side because it sends the entire ROMClass to the JITServer. If we find it worthwhile, we may be able to keep some cache at the client that memorizes which ROMClasses have already been sent to the server so that we don't have to send them again.

@mpirvu mpirvu added the comp:jitserver Artifacts related to JIT-as-a-Service project label May 27, 2020
@mpirvu mpirvu added this to To do in JIT as a Service via automation May 27, 2020
@mpirvu
Copy link
Contributor Author

mpirvu commented May 27, 2020

I am thinking that the best place for collecting message sizes is:

void
CommunicationStream::readMessage(Message &msg)
   {
   msg.clearForRead();

   // read message size
   uint32_t serializedSize;
   readBlocking(serializedSize);
   msg.setSerializedSize(serializedSize);

   // read the rest of the message
   uint32_t messageSize = serializedSize - sizeof(uint32_t);
   readBlocking(msg.getBufferStartForRead() + sizeof(uint32_t), messageSize);

   // rebuild the message
   msg.deserialize();
   }

Here we have access to the total message size and the type of the message can be obtained with msg.type()

@mpirvu
Copy link
Contributor Author

mpirvu commented May 27, 2020

Attn: @EmanElsaban

@mpirvu
Copy link
Contributor Author

mpirvu commented May 29, 2020

Stats could be collected with utilities from omr/compiler/infra/Statistics.hpp
class TR_Stats
or class TR_StatsHisto when the spread is large

EmanElsaban added a commit to EmanElsaban/openj9 that referenced this issue Jun 5, 2020
I'm keeping track of the size of different types of messages sent using msg.type()
and I'm using the class TR_Stats to store avg,min,max and stddev of every type of message.
I declared a static array in CommunicationStream.hpp and I'm using that to store in.
issue: eclipse-openj9#9708

Signed-off-by: Eman Elsabban <eman.elsaban1@gmail.com>
@EmanElsaban
Copy link
Contributor

EmanElsaban commented Jun 8, 2020

This Excel sheet contains the stats collected from Acmeair benchmark:
AcmeAir Message Statistics.xlsx

@mpirvu
Copy link
Contributor Author

mpirvu commented Jun 8, 2020

Thanks.
These are the messages sent by the server and received by the client. It appears that the message with the compiled code can be pretty big, 1K-65K, but the rest are typically less than 100 bytes.

@EmanElsaban could you please generate the same stats from the server point of view (messages received by the server)? In this case you may need to add the print routine to another place.

@EmanElsaban
Copy link
Contributor

EmanElsaban commented Jun 9, 2020

I included the message stats of Acmeair on the client and server side in this excel sheet, Thank you.
AcmeAir MsgStats on client and server side.xlsx

@EmanElsaban
Copy link
Contributor

EmanElsaban commented Jun 9, 2020

I ran it a second trial on Acmeair to print out the total number of messages on server side, since I didn't print it the first trial:
AcmeAir MsgStats on client and server side.xlsx

@mpirvu
Copy link
Contributor Author

mpirvu commented Jun 9, 2020

The compilation request is the largest contributor: it has the largest messages (115KB), the latest average message size (17.5 KB) and the largest number of bytes being received (95 MB). This represents 55% of the total bytes transferred from client to server.
Given this, it may be worthwhile to look into reducing the size of this message as mentioned in the first comment of this issue

EmanElsaban added a commit to EmanElsaban/openj9 that referenced this issue Jun 17, 2020
To trigger the jitDump use the option -Xdump:jit:events=user from the server side
and then run the Java client and then  kill -3 <pidof jitserver>. This will print
the message stats received by the server at shutdown.
issue: eclipse-openj9#9708

Signed-off-by: Eman Elsabban <eman.elsaban1@gmail.com>
a7ehuo added a commit to a7ehuo/openj9 that referenced this issue Jun 24, 2020
The original message read involves at least two reads:
The first one is to read the message size. The second
one is to read the rest of the message based on the
message size that’s read in the first read.
This change optimizes the incoming message read to
attempt to read the full buffer capacity in the first read.
It then decides whether or not subsequent reads are
required based on `bytesRead` from the first read.

Also increase `INITIAL_BUFFER_SIZE` to `18000`
from `10000` based on the average message size observed
in eclipse-openj9#9708.

Implements eclipse-openj9#9711

Signed-off-by: Annabelle Huo <Annabelle.Huo@ibm.com>
EmanElsaban added a commit to EmanElsaban/openj9 that referenced this issue Jul 7, 2020
Stored the ramClasses in an unordered_set before sending the compilation
request to the server. I check if the ram class (clazz) is cached in the set.
if it is not stored then it will be cached in the set and will send the corresponding
ROM by setting the serializeClass bool to true. If the clazz is already in the cache set
this means it has already been sent to the server. So send the clazz again but with empty ROM
class (empty string for ROM Class) by setting serializeClass bool to false.
issue: eclipse-openj9#9708

Signed-off-by: Eman Elsabban <eman.elsaban1@gmail.com>
@mpirvu
Copy link
Contributor Author

mpirvu commented Aug 4, 2020

Resolved by #9870

@mpirvu mpirvu closed this as completed Aug 4, 2020
JIT as a Service automation moved this from To do to Done Aug 4, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
comp:jitserver Artifacts related to JIT-as-a-Service project
Projects
Development

No branches or pull requests

2 participants