Performans İpuçları
Koleksiyonlar ile düzeninizi koruyun
İçeriği tercihlerinize göre kaydedin ve kategorilere ayırın.
Bu dokümanda, uygulamanızın performansını iyileştirmek için kullanabileceğiniz bazı teknikler açıklanmaktadır. Bazı durumlarda, sunulan fikirleri örneklendirmek için diğer API'lerden veya genel API'lerden örnekler kullanılır. Ancak aynı kavramlar Ad Exchange Buyer API için de geçerlidir.
Gzip kullanarak sıkıştırma
Her istek için gereken bant genişliğini azaltmanın kolay ve kullanışlı bir yolu, gzip sıkıştırmasını etkinleştirmektir. Bu, sonuçların sıkıştırmasını açmak için ek CPU süresi gerektirse de ağ maliyetleriyle başa çıkmak genellikle çok zaman alır.
gzip kodlu bir yanıt almak için iki şey yapmanız gerekir: Accept-Encoding
üstbilgisi ayarlayın ve kullanıcı aracınızı gzip
dizesini içerecek şekilde değiştirin. gzip sıkıştırmasını etkinleştirmek için düzgün şekilde oluşturulmuş bir HTTP üstbilgileri örneğini burada bulabilirsiniz:
Accept-Encoding: gzip
User-Agent: my program (gzip)
Kısmi kaynaklarla çalışma
API çağrılarınızın performansını artırmanın bir başka yolu da verilerin yalnızca ilgilendiğiniz kısmını istemektir. Bu sayede uygulamanız gereksiz alanları aktarmak, ayrıştırmak ve depolamaktan kaçınarak ağ, CPU ve bellek gibi kaynakları daha verimli bir şekilde kullanabilir.
Kısmi yanıt
Varsayılan olarak sunucu, istekleri işlendikten sonra kaynağın tam temsilini geri gönderir. Daha iyi performans için sunucudan yalnızca gerçekten ihtiyaç duyduğunuz alanları göndermesini isteyebilir ve bunun yerine kısmi bir yanıt alabilirsiniz.
Kısmi bir yanıt istemek için fields
istek parametresini kullanarak döndürülmesini istediğiniz alanları belirtin. Bu parametreyi, yanıt verileri döndüren herhangi bir istekle kullanabilirsiniz.
Örnek
Aksi belirtilmediği sürece bu sayfanın içeriği Creative Commons Atıf 4.0 Lisansı altında ve kod örnekleri Apache 2.0 Lisansı altında lisanslanmıştır. Ayrıntılı bilgi için Google Developers Site Politikaları'na göz atın. Java, Oracle ve/veya satış ortaklarının tescilli ticari markasıdır.
Son güncelleme tarihi: 2025-07-26 UTC.
[null,null,["Son güncelleme tarihi: 2025-07-26 UTC."],[[["\u003cp\u003eEnabling gzip compression reduces bandwidth usage by compressing data, which often outweighs the cost of extra CPU time required for decompression.\u003c/p\u003e\n"],["\u003cp\u003eTo receive a gzip-encoded response, set the \u003ccode\u003eAccept-Encoding\u003c/code\u003e header to \u003ccode\u003egzip\u003c/code\u003e and include \u003ccode\u003egzip\u003c/code\u003e in your user agent string.\u003c/p\u003e\n"],["\u003cp\u003eRequesting partial resources, by only retrieving the data fields you need, improves application performance by conserving resources such as network, CPU, and memory.\u003c/p\u003e\n"],["\u003cp\u003ePartial responses are achieved by using the \u003ccode\u003efields\u003c/code\u003e request parameter to specify which fields you want returned from the server, instead of receiving the full resource representation.\u003c/p\u003e\n"]]],["To enhance application performance, enable gzip compression by setting the `Accept-Encoding: gzip` header and including `gzip` in the `User-Agent`. Additionally, request only necessary data by utilizing partial responses. Employ the `fields` request parameter to specify desired fields, thereby reducing data transfer, parsing, and storage overhead, optimizing network, CPU, and memory usage. These techniques can be used for the Ad Exchange Buyer API.\n"],null,["# Performance Tips\n\nThis document covers some techniques you can use to improve the performance of your application. In some cases, examples from other APIs or generic APIs are used to illustrate the ideas presented. However, the same concepts are applicable to the Ad Exchange Buyer API.\n\nCompression using gzip\n----------------------\n\nAn easy and convenient way to reduce the bandwidth needed for each request is to enable gzip compression. Although this requires additional CPU time to uncompress the results, the trade-off with network costs usually makes it very worthwhile.\n\nIn order to receive a gzip-encoded response you must do two things: Set an `Accept-Encoding` header, and modify your user agent to contain the string `gzip`. Here is an example of properly formed HTTP headers for enabling gzip compression: \n\n```perl6\nAccept-Encoding: gzip\nUser-Agent: my program (gzip)\n```\n\nWorking with partial resources\n------------------------------\n\nAnother way to improve the performance of your API calls is by requesting only the portion of the data that you're interested in. This lets your application avoid transferring, parsing, and storing unneeded fields, so it can use resources including network, CPU, and memory more efficiently.\n\n### Partial response\n\nBy default, the server sends back the full representation of a resource after processing requests. For better performance, you can ask the server to send only the fields you really need and get a *partial response* instead.\n\nTo request a partial response, use the `fields` request parameter to specify the fields you want returned. You can use this parameter with any request that returns response data.\n\n#### Example"]]