Comments (7)
google-api-php-client-1.0.0-alpha does not have this problem. Upload Traffic Size is almost equal to file size.
So some issue cropped up after the gzip stuff was added
from google-api-php-client.
Very odd, I can see the same thing when uploading to drive. Disabling the gzip seems to bring it back to normal, which is rather confusing. I'll poke around a little more, but we may just need to automatically disable gzip for file upload, which is straightforward.
Workaround is to disable it manually using: $client->setClassConfig("Google_Http_Request", "disable_gzip", true);
from google-api-php-client.
So what I can see is compress.zlib doing an absolute tonne of writes on the upload, which is not very helpful. Unfortunately, I can't find a wonderful work around that lets us deal with the stream filter in a decent way, so I think disabling on uploads will be the best bet.
from google-api-php-client.
Patched in #65
from google-api-php-client.
I'm seeing something very like this with ownCloud's Google Drive support (which I'm still working to get ported to 1.x). It's using extremely simple upload code, ripped straight from the examples:
public function writeBack($tmpFile) {
if (isset(self::$tempFiles[$tmpFile])) {
$path = self::$tempFiles[$tmpFile];
$parentFolder = $this->getDriveFile(dirname($path));
if ($parentFolder) {
// TODO Research resumable upload
$mimetype = \OC_Helper::getMimeType($tmpFile);
$data = file_get_contents($tmpFile);
$params = array(
'data' => $data,
'mimeType' => $mimetype,
'uploadType' => 'media'
);
$result = false;
if ($this->file_exists($path)) {
$file = $this->getDriveFile($path);
$result = $this->service->files->update($file->getId(), $file, $params);
} else {
$file = new \Google_Service_Drive_DriveFile();
$file->setTitle(basename($path));
$file->setMimeType($mimetype);
$parent = new \Google_Service_Drive_ParentReference();
$parent->setId($parentFolder->getId());
$file->setParents(array($parent));
$result = $this->service->files->insert($file, $params);
}
if ($result) {
$this->setDriveFile($path, $result);
}
}
unlink($tmpFile);
}
}
and I'm currently testing with version 1.0.6 of the library. But I seem to be seeing just the same issue as the OP here - uploading a simple ~4MB file results in over 100MB of traffic. Any ideas?
from google-api-php-client.
Ah. I think the fix for this may have only fixed it for use of the Google_Http_MediaFileUpload class, not the simple files->insert method. Let me see if my theory holds up.
from google-api-php-client.
Hum. Actually, I think I was using a packaged copy of 1.0.3 I had lying around and somehow with 1.0.6 the problem doesn't happen any more, though I can't clearly see why it would affect 1.0.3 but not 1.0.6. But hey, so long as it works...hey ho.
Aha! So I think I'm not hitting it in 1.0.6 because it's using Curl instead of Stream and bypassing the whole thing. If I force use of Stream instead of Curl, I can cause it to happen again.
In MediaFileUpload.php , the bit where it conditionally disables gzip for uploads is only in nextChunk()
, which is only used for resumable uploads. I've tried copying it into process()
(with the obvious change to $this->request
instead of $httpRequest
), and the code gets hit (I put a debug log in to check), but it doesn't seem to do the job - the amount of data transferred is still huge. But if I disable gzip with the big hammer - $client->setClassConfig("Google_Http_Request", "disable_gzip", true);
- that does solve the problem. Not quite sure why just trying to disable it in process()
doesn't work.
from google-api-php-client.
Related Issues (20)
- What is redirect url HOT 1
- Status run HOT 2
- Problem retrieving domain user list HOT 1
- Feat. request: timeout for default http client
- Uncaught Error: Class 'Google_Service_Customsearch' HOT 2
- insert product using google-api-php-client HOT 1
- Changing OAuth scope giving invalid credentials error for existing users when appending rows in google sheet.
- PAGINATION - Next page token is always null ? HOT 1
- Issue with Namespacing Google Libraries in WordPress Plugin HOT 2
- Issue with Namespacing Google Libraries in WordPress Plugin HOT 1
- [reasonPhrase:GuzzleHttp\Psr7\Response:private] => Forbidden HOT 3
- Dependency phpseclib/phpseclib has a security update HOT 1
- Support for "forHandle" parameter in youtube->channels->list request HOT 3
- https://oauth2.googleapis.com/token curl: (28) Failed to connect to oauth2.googleapis.com port 443 after 227030 ms: Couldn't connect to server HOT 1
- Extending Google Analytics APIs: Best Practices and Customization Techniques HOT 1
- How to set "enable_granular_consent" parameter on Client.php? HOT 4
- Hey, I’ve been working with Swoole and I think there’s an issue when the application runs in a resident memory environment HOT 1
- Oath without json file HOT 1
- Uncaught TypeError: Argument must be an instance of RenderAccountIssuesRequestPayload HOT 1
- Custom Namespace issue on google analytics-admin and analytics-data php api. HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from google-api-php-client.