{
  "id": 23909139,
  "title": "Your PLC Doesn't Care About Your Event Loop",
  "url": "https://urgent.news/2026/12/06/your-plc-doesnt-care-about-your-event-loop",
  "topic": "tech",
  "section": "Tech",
  "published": "2026-12-06T21:29:17.000Z",
  "source": {
    "name": "Dev.to",
    "slug": "dev-to",
    "url": "https://dev.to/mkkiefer/your-plc-doesnt-care-about-your-event-loop-1h4"
  },
  "original_language": null,
  "account": "Four key takeaways emerged from moving asyncio to the factory floor:\n\n1. Round-trips are costly. A PLC responds quickly to a single read, but repeated requests cause latency. Batch requests together using sum commands to reduce round-trip time. However, remember that the PLC limits how much data can be batched in one request.\n\n2. Async does not equal non-blocking. While the network side of an async ADS client is straightforward, decoding large responses is CPU-intensive and can block the event loop if not handled properly. Split work between chunks and use a thread pool for decoding to keep the event loop responsive.\n\n3. Polling is a habit, but notifications are better. ADS offers a push-based model where the PLC sends updates when values change. Implement bounded queues with explicit overflow policies to handle cases where the consumer cannot keep up with the PLC's data rate. Tailor the backpressure policy to your specific use case (e.g., drop oldest, keep recent values, or deliver only the current value).\n\n4. Keep protocol and transport separate. While the classic setup is a client connecting directly to a controller via TCP, modern installations often involve edge gateways, firewalls, or message brokers like MQTT. Design your code with a clear separation between the protocol (ADS) and the transport (TCP or MQTT) to make future network changes less painful.",
  "summary": "Four lessons from putting asyncio on the factory floor At some point, almost every automation team picks up Python. It rarely starts as a big decision. Someone needs a quick script to log a few PLC variables to a CSV. Then the script needs a small web dashboard. Then it has to push data to a database, watch a second machine, and send an alert when a value drifts. A few months later the \"quick…",
  "summary_source": "publisher",
  "key_points": [
    "Round-trips to PLCs are costly; batch requests to reduce latency.",
    "Async ADS clients can block event loops if decoding large responses improperly.",
    "Separate protocol (ADS) from transport (TCP/MQTT) for easier network changes."
  ],
  "editors_take": null,
  "opinion": false,
  "illustration": null,
  "coverage": {
    "outlets": 1,
    "outlets_capped": false,
    "also_reported_by": []
  },
  "machine_translated": false,
  "ai_generated": true,
  "disclaimer": "Accounts, briefs, key points, the editor’s take and translations are written by software from other outlets’ reporting and may contain errors. A summary whose summary_source is \"publisher\" is the outlet’s own feed text. Always check the linked original."
}