Assaf,

Unfortunately I'm not too familiar with the Python library to comment on 
its thread safety.
The Java version is marked as thread safe - you should be able to reuse the 
same Credential objects in different AdWordsSession object

However, you may still need a different AdWordsSession object because you 
will need to specify a different client customer ID for different accounts 
in your MCC.

I hope this helps.  Thanks!

--
Ray Tsang (AdWords API Advisor)


On Thursday, January 16, 2014 12:42:51 PM UTC-5, Martin wrote:
>
> Hi Ray, What is the equivalent of sharing the Credential Object fo the 
> Python library?
> Is this valid for threads working on different accounts under the same MCC?
> Thanks,
> Martin
>
> On Thursday, 16 January 2014 14:39:57 UTC-3, Ray Tsang (AdWords API Team) 
> wrote:
>>
>> Assaf,
>>
>> If you are using the OAuth 2.0 with a single top level MCC - you should 
>> share the Credential 
>> object<http://javadoc.google-oauth-java-client.googlecode.com/hg/1.17.0-rc/com/google/api/client/auth/oauth2/Credential.html?is-external=true>among
>>  the threads (it's thread-safe).
>>
>> Whether you should create new AdWordsSession/AdWordsServices - it really 
>> depends on your use case and your application's design pattern.  However, 
>> if these objects are short-lived, the answer is really by tuning your JVM 
>> to make sure the GC strategy matches your application's behavior.
>>
>> Unfortunately I won't be able to comment on either of the above points.
>>
>> Thanks,
>>
>> --
>> Ray Tsang (AdWords API Advisor)
>>
>>
>> On Thursday, January 16, 2014 3:05:17 AM UTC-5, assaf wrote:
>>>
>>> Thanks for the feedback.
>>>
>>> one other issue -
>>> What is the best practice for AdWordsSession and AdWordsServices 
>>> creation?
>>> Should I be reusing these objects during frequent API calls (as static 
>>> variables)  - does creating new ones affect my memory?
>>>
>>> Thanks.
>>>
>>> On Thursday, January 16, 2014 1:52:11 AM UTC+2, Ray Tsang (AdWords API 
>>> Team) wrote:
>>>>
>>>> Assaf,
>>>>
>>>> The log is usually configured through log4j.  You will need to turn off 
>>>> debug logging (or turn it off for specific packages).  The exact 
>>>> configuration depends on your environment, however.  You can start with 
>>>> AdWords 
>>>> API Java Client 
>>>> README<https://github.com/googleads/googleads-java-lib#how-do-i-enable-logging>or
>>>>  Tomcat's 
>>>> Log4j 
>>>> usage<http://tomcat.apache.org/tomcat-6.0-doc/logging.html#Using_Log4j>
>>>> .
>>>>
>>>> Heap usage tend to grow over time due to the fact that garbage 
>>>> collection may not be occuring and/or aggressive.  If you force a GC, you 
>>>> should see the heap usage reduced.
>>>>
>>>> However, if you see that there are heap usages that grows over time 
>>>> permanently and cannot be garbage collected then it may indicate a real 
>>>> issue.
>>>>
>>>> Lastly - it's always recommended to tune your JVM garbage collector 
>>>> specific for your application.
>>>>
>>>> Thanks!
>>>>
>>>> --
>>>> Ray Tsang (AdWords API Advisor)
>>>>
>>>>
>>>> On Monday, January 13, 2014 10:06:35 AM UTC-5, assaf wrote:
>>>>>
>>>>> Regarding to the storage issue-
>>>>>
>>>>> I see a text log file called jxl is created is it grows very very 
>>>>> quickly.
>>>>> The contents are something like -
>>>>>
>>>>> 2014-01-13 15:00:33,372 [DEBUG] org.apache.axis.utils.NSStack  - NSPop 
>>>>> (32)
>>>>> 2014-01-13 15:00:33,372 [DEBUG] org.apache.axis.message.SAXOutputter 
>>>>>  - SAXOutputter.startElement ['
>>>>> https://adwords.google.com/api/adwords/cm/v201309' Criterion.Type]
>>>>> 2014-01-13 15:00:33,372 [DEBUG] 
>>>>> org.apache.axis.i18n.ProjectResourceBundle  - 
>>>>> org.apache.axis.i18n.resource::handleGetObject(startElem00)
>>>>> 2014-01-13 15:00:33,372 [DEBUG] 
>>>>> org.apache.axis.encoding.SerializationContext  - Start element [
>>>>> https://adwords.google.com/api/adwords/cm/v201309]:Criterion.Type
>>>>> 2014-01-13 15:00:33,372 [DEBUG] org.apache.axis.utils.NSStack  - 
>>>>> NSPush (32)
>>>>> 2014-01-13 15:00:33,372 [DEBUG] org.apache.axis.message.SAXOutputter 
>>>>>  - SAXOutputter.characters ['Keyword']
>>>>> 2014-01-13 15:00:33,372 [DEBUG] org.apache.axis.message.SAXOutputter 
>>>>>  - SAXOutputter.endElement ['
>>>>> https://adwords.google.com/api/adwords/cm/v201309' Criterion.Type]
>>>>> 2014-01-13 15:00:33,372 [DEBUG] 
>>>>> org.apache.axis.i18n.ProjectResourceBundle  - 
>>>>> org.apache.axis.i18n.resource::handleGetObject(endElem00)
>>>>> 2014-01-13 15:00:33,372 [DEBUG] 
>>>>> org.apache.axis.encoding.SerializationContext  - End element 
>>>>> Criterion.Type
>>>>> 2014-01-13 15:00:33,372 [DEBUG] org.apache.axis.utils.NSStack  - NSPop 
>>>>> (32)
>>>>> 2014-01-13 15:00:33,372 [DEBUG] org.apache.axis.message.SAXOutputter 
>>>>>  - SAXOutputter.startElement ['
>>>>> https://adwords.google.com/api/adwords/cm/v201309' text]
>>>>> 2014-01-13 15:00:33,372 [DEBUG] 
>>>>> org.apache.axis.i18n.ProjectResourceBundle  - 
>>>>> org.apache.axis.i18n.resource::handleGetObject(startElem00)
>>>>> 2014-01-13 15:00:33,372 [DEBUG] 
>>>>> org.apache.axis.encoding.SerializationContext  - Start element [
>>>>> https://adwords.google.com/api/adwords/cm/v201309]:text
>>>>> 2014-01-13 15:00:33,372 [DEBUG] org.apache.axis.utils.NSStack  - 
>>>>> NSPush (32)
>>>>>
>>>>>
>>>>> How can I turn off this debug because it causes my server to fill up 
>>>>> completely every day?
>>>>>
>>>>> I would appreciate an answer on the memory issue / best way for 
>>>>> creating/calling session and AdwrodsServices objects..
>>>>>
>>>>> Thanks.
>>>>>
>>>>> On Saturday, January 11, 2014 9:37:51 PM UTC+2, assaf wrote:
>>>>>>
>>>>>> Hi,
>>>>>>
>>>>>> My application calls Java API via different services ( 
>>>>>> CampaignServiceInterface,CampaignCriterionServiceInterface etc),using -
>>>>>>
>>>>>>  Credential oAuth2Credential = new OfflineCredentials.Builder()
>>>>>>         .forApi(Api.ADWORDS)
>>>>>>         .fromFile()
>>>>>>         .build()
>>>>>>         .generateCredential();
>>>>>>
>>>>>> // Construct an AdWordsSession.
>>>>>> AdWordsSession session = new AdWordsSession.Builder()
>>>>>>         .fromFile()
>>>>>>         .withOAuth2Credential(oAuth2Credential)
>>>>>>         .build();
>>>>>>         
>>>>>> session.setClientCustomerId(pClientID);
>>>>>>     
>>>>>> AdWordsServices adwordsServices = new AdWordsServices();
>>>>>> CampaignServiceInterface campaignService = 
>>>>>> adwordsServices.get(session, CampaignServiceInterface.class);
>>>>>>
>>>>>> This is done every hour for several dozen clients.
>>>>>> I am using Java application running on Tomcat using API version 
>>>>>> v201309.
>>>>>>
>>>>>> What I see is 2 issues:
>>>>>>
>>>>>> 1. The Tomcat process memory consumption grows with time.
>>>>>> 2. The consumed physical memory of the C drive of the server grows 
>>>>>> very quickly and uses all the free space. I can't really locate where
>>>>>>     all the storage going but I suspect some kind of tmp file or log 
>>>>>> file that is being written by the API.
>>>>>> Once I restart the Tomcat all the memory and storage is released.
>>>>>>
>>>>>> My questions:
>>>>>> 1. Is there a known issue with memory leaks?
>>>>>> 2. Are there better ways for using the API than how I am implementing 
>>>>>> my needs?
>>>>>>
>>>>>>    - 
>>>>>> *   Perhaps have only 1 session per client created and used every 
>>>>>>    hour rather than re-creating it? *
>>>>>>    -    *Perhaps creating the AdwordsServices object every hour is 
>>>>>>    not correct and I should have 1 instance for the entire application 
>>>>>> or 1 
>>>>>>    per service?*
>>>>>>    
>>>>>> I appreciate any feedback and help in the matter.
>>>>>>
>>>>>> Many thanks.
>>>>>>
>>>>>

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and discussion group:
http://googleadsdeveloper.blogspot.com
http://groups.google.com/group/adwords-api
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

You received this message because you are subscribed to the Google
Groups "AdWords API Forum" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/adwords-api?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"AdWords API Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to