อัปเดตข้อจํากัด
จัดทุกอย่างให้เป็นระเบียบอยู่เสมอด้วยคอลเล็กชัน
บันทึกและจัดหมวดหมู่เนื้อหาตามค่ากำหนดของคุณ
เอกสารนี้ใช้กับวิธีการต่อไปนี้
Update API (v4):
threatListUpdates.fetch
การตั้งค่าข้อจำกัด
เมื่ออัปเดตฐานข้อมูลภายใน
(ดูการอัปเดตฐานข้อมูล)
ไคลเอ็นต์จะใช้ช่อง maxUpdateEntries
และ maxDatabaseEntries
ใน
คำขอ threatListUpdates.fetch
เพื่อระบุข้อจำกัดด้านขนาดได้ ไคลเอ็นต์ควรกำหนดข้อจำกัดเพื่อรักษาการใช้ RAM, ดิสก์ และแบนด์วิดท์ของไคลเอ็นต์แบบคาดเดาได้ รวมถึงเพื่อป้องกันการเพิ่มขึ้นของรายการ
- ไคลเอ็นต์จะระบุขนาดการตอบกลับสูงสุดของการอัปเดตได้ (
maxUpdateEntries
) ตามจำนวนรายการ
(1 รายการ = เพิ่ม 1 รายการหรือนำออก 1 รายการ)
- ไคลเอ็นต์จะระบุขนาดสูงสุดของฐานข้อมูล (
maxDatabaseEntries
) ได้หลายรายการ (รายการส่วนใหญ่ในฐานข้อมูลเป็นคำนำหน้าแฮชแบบ 4 ไบต์ จึงถือว่าเหมาะสมที่จะสมมติว่า 1 รายการ ≈ 4 ไบต์)
แบนด์วิดท์เทียบกับพื้นที่เก็บข้อมูล
แม้ว่าไคลเอ็นต์จะระบุขนาดที่กำหนดเองสำหรับการตอบสนองของการอัปเดตและขนาดฐานข้อมูล แต่เซิร์ฟเวอร์ Safe Browsing จะสร้างคำตอบในการอัปเดตและขนาดฐานข้อมูลให้ล่วงหน้าเป็นจำนวนที่จำกัดเท่านั้น
- ไคลเอ็นต์ควรใช้ขนาดการตอบสนองของการอัปเดต (
maxUpdateEntries
) เพื่อจำกัดการใช้งานแบนด์วิดท์
- ไคลเอ็นต์ควรใช้ขนาดฐานข้อมูล (
maxDatabaseEntries
) เพื่อจำกัดจำนวน RAM หรือพื้นที่เก็บข้อมูลในดิสก์ที่อุปกรณ์ต้องใช้
ข้อจำกัดทั้ง 2 อย่างนี้มีผลต่อขนาดของฐานข้อมูลที่กำลังอัปเดต ดังนั้นจึงมีผลต่อปริมาณการคุ้มครองที่มีต่อผู้ใช้ (กล่าวคือ ยิ่งฐานข้อมูลภายในมีขนาดใหญ่ขึ้นเท่าใด การป้องกันก็จะยิ่งดีขึ้นเท่านั้น)
คำแนะนำสำหรับการกำหนดข้อจำกัด
รายการ Google Safe Browsing สามารถค่อยๆ เปลี่ยนขนาดหรือค่อยๆ เปลี่ยนแปลงไปได้ ไคลเอ็นต์ควรตั้งค่า maxUpdateEntries
สำหรับคำขออัปเดตรายการ ซึ่งจะจำกัดขนาดการตอบกลับการอัปเดตรายการสูงสุดและปรับปรุงความน่าเชื่อถือเมื่อประมวลผลการอัปเดตขนาดใหญ่ไม่ได้
ในกรณีที่ไม่มีข้อกำหนดที่เข้มงวดกว่าหรือข้อกำหนดที่เข้มงวดน้อยกว่า Google ขอแนะนำให้ใช้ maxUpdateEntries=16777216
ด้วยขนาดรายการทั่วไปที่ 4 ไบต์ต่อคำนำหน้าแฮช ซึ่งเท่ากับประมาณ 67 เมกะไบต์ต่อรายการ Google ขอแนะนำให้ใช้ขีดจำกัดที่น้อยกว่า maxUpdateEntries=2097152
สำหรับไคลเอ็นต์อุปกรณ์เคลื่อนที่ เนื่องจากมักจะมีประสิทธิภาพน้อยกว่า ที่ขนาดข้อมูลรายการทั่วไปที่ 4 ไบต์ต่อคำนำหน้าแฮช ซึ่งเท่ากับประมาณ 8 เมกะไบต์ต่อรายการ
รายการ Google Safe Browsing มีขนาดและอัตราการเติบโตแตกต่างกัน อย่างไรก็ตาม ไคลเอ็นต์ควรตั้งข้อจำกัดเดียวกันสำหรับรายการทั้งหมด โดยอิงตามการใช้หน่วยความจำหรือแบนด์วิดท์สูงสุดที่อนุญาตสำหรับแต่ละรายการ
Google ขอแนะนำให้ไคลเอ็นต์ใช้การวัดและส่งข้อมูลทางไกลในการตรวจหาการใช้หน่วยความจำหรือแบนด์วิดท์ที่มากเกินไป รวมถึงกลไกต่างๆ ในการส่งข้อจำกัดใหม่ไปยังไคลเอ็นต์อย่างรวดเร็วเพื่อปรับปรุงความน่าเชื่อถือ
สถานะไคลเอ็นต์
เซิร์ฟเวอร์ Google Safe Browsing จะไม่ส่งอัปเดตที่ปล่อยให้ไคลเอ็นต์อยู่ในสถานะล้าสมัย ไคลเอ็นต์จะได้รับข้อมูลอัปเดตทั้งหมดหลังจากคําขออัปเดตทุกครั้ง เช่น หากปัจจุบันไคลเอ็นต์มีฐานข้อมูล รายการ 4, 096 รายการ แต่ต้องการดาวน์โหลดเดลต้าไม่เกิน 2, 048 รายการเท่านั้น เซิร์ฟเวอร์อาจรีเซ็ตไคลเอ็นต์เป็นฐานข้อมูล 2048 หากไคลเอ็นต์ไม่เป็นปัจจุบันจริงๆ
เนื้อหาของหน้าเว็บนี้ได้รับอนุญาตภายใต้ใบอนุญาตที่ต้องระบุที่มาของครีเอทีฟคอมมอนส์ 4.0 และตัวอย่างโค้ดได้รับอนุญาตภายใต้ใบอนุญาต Apache 2.0 เว้นแต่จะระบุไว้เป็นอย่างอื่น โปรดดูรายละเอียดที่นโยบายเว็บไซต์ Google Developers Java เป็นเครื่องหมายการค้าจดทะเบียนของ Oracle และ/หรือบริษัทในเครือ
อัปเดตล่าสุด 2025-07-25 UTC
[[["เข้าใจง่าย","easyToUnderstand","thumb-up"],["แก้ปัญหาของฉันได้","solvedMyProblem","thumb-up"],["อื่นๆ","otherUp","thumb-up"]],[["ไม่มีข้อมูลที่ฉันต้องการ","missingTheInformationINeed","thumb-down"],["ซับซ้อนเกินไป/มีหลายขั้นตอนมากเกินไป","tooComplicatedTooManySteps","thumb-down"],["ล้าสมัย","outOfDate","thumb-down"],["ปัญหาเกี่ยวกับการแปล","translationIssue","thumb-down"],["ตัวอย่าง/ปัญหาเกี่ยวกับโค้ด","samplesCodeIssue","thumb-down"],["อื่นๆ","otherDown","thumb-down"]],["อัปเดตล่าสุด 2025-07-25 UTC"],[[["\u003cp\u003eThe Safe Browsing API allows clients to set constraints on update and database sizes to manage resource usage.\u003c/p\u003e\n"],["\u003cp\u003eClients can limit bandwidth with \u003ccode\u003emaxUpdateEntries\u003c/code\u003e and storage with \u003ccode\u003emaxDatabaseEntries\u003c/code\u003e to optimize performance.\u003c/p\u003e\n"],["\u003cp\u003eGoogle provides recommended constraint values for different client types to balance protection and resource consumption.\u003c/p\u003e\n"],["\u003cp\u003eThe Safe Browsing server ensures clients remain up-to-date even with constrained updates, potentially resetting the database if necessary.\u003c/p\u003e\n"]]],["Clients updating local databases via the `threatListUpdates.fetch` API can set size constraints using `maxUpdateEntries` (for update response size, limiting bandwidth) and `maxDatabaseEntries` (for database size, limiting storage). Google recommends `maxUpdateEntries=16777216` (67MB) for most clients and `2097152` (8MB) for mobile. These constraints should be consistently applied across all lists, with telemetry to detect overusage. The server ensures clients are always fully updated, potentially resetting to smaller databases if necessary.\n"],null,["# Update Constraints\n\nThis document applies to the following method:\n[Update API (v4)](/safe-browsing/v4/update-api):\n[threatListUpdates.fetch](/safe-browsing/v4/update-api#example-threatListUpdatesfetch).\n\nSetting constraints\n-------------------\n\nWhen updating local databases\n(see [Database Updates](/safe-browsing/v4/local-databases#database-updates))\nclients can use the `maxUpdateEntries` and `maxDatabaseEntries` fields in the\n[threatListUpdates.fetch request](/safe-browsing/v4/update-api#http-post-request)\nto specify size constraints. Clients should set constraints to maintain\npredictable consumption of client RAM, disk, and bandwidth, and to safeguard\nagainst list growth.\n\n- Clients can specify a maximum update response size (`maxUpdateEntries`) in number of entries (1 entry = 1 addition or 1 removal).\n- Clients can specify a maximum database size (`maxDatabaseEntries`) in number of entries (the vast majority of entries in the database are 4-byte hash prefixes so it's fair to assume that 1 entry ≈ 4 bytes).\n\nBandwidth vs. storage\n---------------------\n\nWhile clients may specify arbitrary sizes for the update response and database sizes, the Safe\nBrowsing server only pre-generates a finite number of possible update response and database sizes.\n\n- Clients should use the update response size (`maxUpdateEntries`) to limit bandwidth usage.\n- Clients should use the database size (`maxDatabaseEntries`) to limit the amount of RAM or disk storage needed on the device.\n\nBoth of these limits have an effect on the size of the database that is being updated and therefore have an impact on the amount of protection provided to the user (that is, the larger the local database size the better the protection).\n\n\u003cbr /\u003e\n\nGuidance for setting constraints\n--------------------------------\n\nSafe Browsing lists can gradually or suddenly change in size. Clients should\nset the `maxUpdateEntries` for list update requests, which limits the\nmaximum list update response size and improves reliability when large updates\ncannot be processed.\n\nIn the absence of stricter requirements or requirements that are less strict,\nGoogle recommends using `maxUpdateEntries=16777216`. With the typical\nlist entry size of 4 bytes per hash prefix, this equates to approximately 67\nmegabytes per list. Google recommends using the smaller limit\n`maxUpdateEntries=2097152` for mobile clients, because they are\nusually less powerful. At the typical list entry size of 4 bytes per hash\nprefix, this equates to approximately 8 megabytes per list.\n\nSafe Browsing lists differ in size and growth rate. However, clients should\nset the same constraints for all lists, based on the maximum allowed memory or\nbandwidth usage for each list.\n\nTo improve reliability, Google recommends that clients implement telemetry\nfor detecting memory or bandwidth overusage, as well as mechanisms to quickly\ndeliver new constraints to clients.\n\nClient state\n------------\n\nThe Safe Browsing server never sends an update that leaves the client in an outdated state;\nclients will be fully up-to-date after every update request. For example, if a client currently has\na database of 4096 entries but only wants to download at most 2048 deltas, the server may reset the\nclient to a 2048 database if the client is really out-of-date."]]