Performansı Artırma
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 teknikler açıklanmaktadır.
Kullandığınız API'nin belgelerinde,
daha fazla ayrıntı içeren benzer bir sayfayı da ziyaret edebilirsiniz.
Örneğin, bkz.
Google Drive API için Performans İpuçları sayfası.
gzip hakkında
Bu istemci kitaplığı, tüm API yanıtları ve sıkıştırılmış dosya açma işlemleri için gzip sıkıştırması isteğinde bulunuyor
bu verileri sizin için derledik.
Bu işlem, sonuçların sıkıştırmasını açmak için ek CPU süresi gerektirse de
ağ maliyetlerindeki denge genellikle bu çabaya değiyor.
Kısmi yanıt (fields parametresi)
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 ihtiyacınız olan alanları göndermesini isteyebilir ve bunun yerine kısmi bir yanıt alabilirsiniz.
Kısmi yanıt istemek için:
standart Fields
parametresini herhangi bir API yöntemine ekleyin.
Bu parametrenin değeri, döndürülmesini istediğiniz alanları belirtir.
Bu parametreyi, yanıt verileri döndüren herhangi bir istekle kullanabilirsiniz.
Aşağıdaki kod snippet'inde,
Keşif hizmetinin GetRest
yöntemi çağrılır.
Fields
parametresinin değeri description,title
olarak ayarlanmış.
Sonuç olarak, döndürülen nesne yalnızca açıklama ve başlık alanlarını içerir.
var service = new DiscoveryService();
var request = service.Apis.GetRest("calendar", "v3");
request.Fields = "description,title";
var result = request.Execute();
İstenen alanları ayırmak için virgüllerin nasıl kullanıldığına dikkat edin.
ve eğik çizgiler, üst alanlarda yer alan alanları belirtmek için kullanılır.
Fields
parametresi için başka biçimlendirme seçenekleri de vardır;
Ayrıntılar için "Performans İpuçları"na bakın sayfa
belgelerindeki adımları uygulayın.
Kısmi güncelleme (yama)
Çağırdığınız API yamayı destekliyorsa
Böylece kaynaklarda değişiklik yaparken gereksiz verilerin gönderilmesini önleyebilirsiniz.
Bu API'ler için Patch
yöntemini çağırabilir ve
ve kaynak için değiştirmek istediğiniz bağımsız değişkenleri sağlamalısınız.
Yama semantiği hakkında daha fazla bilgi için
"Performans İpuçları"nı sayfasındaki adımları uygulayın.
Toplu
Çok sayıda küçük istek gönderiyorsanız
topluluk,
Bu da söz konusu isteklerin tek bir HTTP isteğinde paketlenmesini sağlar.
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\u003eThis document provides techniques to enhance your application's performance by reducing network costs and unnecessary data transfers.\u003c/p\u003e\n"],["\u003cp\u003eUtilize the \u003ccode\u003eFields\u003c/code\u003e parameter for partial responses, retrieving only the necessary data from the server.\u003c/p\u003e\n"],["\u003cp\u003eEmploy \u003ccode\u003ePatch\u003c/code\u003e for partial updates, sending only modified data when making changes to resources.\u003c/p\u003e\n"],["\u003cp\u003eLeverage batching to combine multiple small requests into a single HTTP request, reducing overhead.\u003c/p\u003e\n"],["\u003cp\u003eConsult the specific API documentation's "Performance Tips" page for detailed guidance on these techniques.\u003c/p\u003e\n"]]],[],null,["# Improve Performance\n\nThis document covers techniques you can use to improve the performance of your application.\nThe documentation for the specific API you are using should have a\nsimilar page with more detail on some of these topics.\nFor example, see the\n[Performance Tips page for the Google Drive API](/drive/performance).\n\nAbout gzip\n----------\n\n\nThis client library requests gzip compression for all API responses and unzips\nthe data for you.\nAlthough this requires additional CPU time to uncompress the results,\nthe tradeoff with network costs usually makes it worthwhile.\n\nPartial response (fields parameter)\n-----------------------------------\n\n\nBy default, the server sends back the full representation of a resource after processing requests.\nFor better performance,\nyou can ask the server to send only the fields you really need and get a *partial response* instead.\n\n\nTo request a partial response,\nadd the standard `Fields` parameter to any API method.\nThe value of this parameter specifies the fields you want returned.\nYou can use this parameter with any request that returns response data.\n\n\nIn the following code snippet,\nthe `GetRest` method of the Discovery service is called.\nThe value of the `Fields` parameter is set to `description,title`.\nAs a result, the returned object will include only the description and title fields. \n\n```gdscript\nvar service = new DiscoveryService();\nvar request = service.Apis.GetRest(\"calendar\", \"v3\");\nrequest.Fields = \"description,title\";\nvar result = request.Execute();\n \n```\n\n\nNote how commas are used to delimit the desired fields,\nand slashes are used to indicate fields that are contained in parent fields.\nThere are other formatting options for the `Fields` parameter;\nfor details, see the \"Performance Tips\" page\nin the documentation for the API you are using.\n\nPartial update (patch)\n----------------------\n\n\nIf the API you are calling supports patch,\nyou can avoid sending unnecessary data when modifying resources.\nFor these APIs, you can call the `Patch` method and\nsupply the arguments you wish to modify for the resource.\n\n\nFor more information about patch semantics,\nsee the \"Performance Tips\" page in the documentation for the API you are using.\n\nBatch\n-----\n\n\nIf you are sending many small requests you may benefit from\n[batching](/api-client-library/dotnet/guide/batch),\nwhich allows those requests to be bundled into a single HTTP request."]]