Reputation: 2396
In local development mode, I can read from a ~7.4MB file in my war/ directory into an object, using the following code (with all the try/catch stuff removed)
FileInputStream fis;
fis = new FileInputStream("myObject.dat");
ObjectInputStream ois;
ois = new ObjectInputStream(fis);
myObject = (ArrayList<ArrayList<ArrayList<float[]>>>) ois.readObject(); //-- ! prod mode gets stuck here! but dev mode is fine
In local development mode, it works great and reads the object in a few seconds.
When I deploy to AppEngine, I get time-out errors reading the file. It finds the file and starts reading, but can't finish in time. Here's some of the error stack:
java.lang.ExceptionInInitializerError ...
Caused by: com.google.apphosting.api.DeadlineExceededException: This request (...) started at 2012/06/21 02:19:57.368 UTC and was still executing at 2012/06/21 02:20:56.928 UTC. at java.io.FileInputStream.read(Native Method) ...
When I make the "myObject.dat" file smaller, it works in production mode, so the code itself is fine, it's just that GAE can't read the larger file fast enough like my local mode can! How can a GAE server be slower than my little local machine?
Upvotes: 0
Views: 224
Reputation: 24956
Have you looked at how much memory is consumed in your development environment when you read the file and instantiate objects that way, comparing that to the class of front-end instance that you have configured?
The development appserver doesn't attempt to simulate the memory sizes of the various class of frontends.
Upvotes: 1
Reputation: 80330
Java serialization (e.g. ObjectInputStream
) is not a standardized way to store objects: it is not guaranteed to work across different JVM implementations or even between different versions of the same JVM.
Use some other more standardized way to store object data: JSON and XML for example. You might also fing protocol buffers useful.
Upvotes: 0