Google App Engine中的Blobstore对象的1MB配额限制?
问题描述:
我使用 App Engine(版本1.4.3)直接编写blobstore 以保存图像。
当我尝试存储大于1MB的图片时我收到以下异常
I'm using App Engine (version 1.4.3) direct write the blobstore in order to save images. when I try to store an image which is larger than 1MB I get the following Exception
com.google.apphosting.api.ApiProxy$RequestTooLargeException: The request to API call datastore_v3.Put() was too large.
我认为每个对象的限制为2GB
这里是存储Java代码图像
Here is the Java code that stores the image
private void putInBlobStore(final String mimeType, final byte[] data) throws IOException {
final FileService fileService = FileServiceFactory.getFileService();
final AppEngineFile file = fileService.createNewBlobFile(mimeType);
final FileWriteChannel writeChannel = fileService.openWriteChannel(file, true);
writeChannel.write(ByteBuffer.wrap(data));
writeChannel.closeFinally();
}
答
最大对象大小为2 GB,但每个API调用最多只能处理1 MB。至少对于阅读而言,但我认为写作可能是一样的。所以你可能会试图将你写入的对象分成1 MB大块,看看是否有帮助。
The maximum object size is 2 GB but each API call can only handle a maximum of 1 MB. At least for reading, but I assume it may be the same for writing. So you might try to split your writing of the object into 1 MB chunks and see if that helps.