Implementing workload management - Amazon Redshift
AWS 文档中描述的 AWS 服务或功能可能因区域而异。要查看适用于中国区域的差异,请参阅中国的 AWS 服务入门

如果我们为英文版本指南提供翻译,那么如果存在任何冲突,将以英文版本指南为准。在提供翻译时使用机器翻译。

Implementing workload management

您可以使用工作负载管理 (WLM) 定义多个查询队列并在运行时将查询路由到适当的队列。

在一些情况下,您可能有多个会话或用户同时运行查询。在这些情况下,某些查询可能会长时间占用集群资源,从而影响其他查询的性能。例如,假设一组用户时不时提交复杂、耗时的查询(从多个大型表中选择和排序行)。另一组用户经常提交短查询(仅从一个或两个表中选择少量行,运行时长只有数秒)。这种情况下,短时查询可能不得不在队列中等待耗时查询完成。WLM 帮助应对这种情况。

您可以配置 Amazon Redshift WLM 以通过自动 WLM 或手动 WLM 运行。

  • Automatic WLM

    To maximize system throughput and use resources effectively, you can enable Amazon Redshift to manage how resources are divided to run concurrent queries with automatic WLM. Automatic WLM manages the resources required to run queries. Amazon Redshift determines how many queries run concurrently and how much memory is allocated to each dispatched query. You can enable automatic WLM using the Amazon Redshift console by choosing Switch WLM mode and then choosing Auto WLM. With this choice, up to eight queues are used to manage queries, and the Memory and Concurrency on main fields are both set to Auto. You can specify a priority that reflects the business priority of the workload or users that map to each queue. The default priority of queries is set to Normal. For information about how to change the priority of queries in a queue, see Query priority. For more information, see Implementing automatic WLM.

    At runtime, you can route queries to these queues according to user groups or query groups. You can also configure a query monitoring rule (QMR) to limit long-running queries.

    Working with concurrency scaling and automatic WLM, you can support virtually unlimited concurrent users and concurrent queries, with consistently fast query performance. For more information, see Working with concurrency scaling.

    注意

    We recommend that you create a parameter group and choose automatic WLM to manage your query resources. For details about how to migrate from manual WLM to automatic WLM, see Migrating from manual WLM to automatic WLM.

  • Manual WLM

    Alternatively, you can manage system performance and your users' experience by modifying your WLM configuration to create separate queues for the long-running queries and the short-running queries. At runtime, you can route queries to these queues according to user groups or query groups. You can enable this manual configuration using the Amazon Redshift console by switching to Manual WLM. With this choice, you specify the queues used to manage queries, and the Memory and Concurrency on main field values. With a manual configuration, you can configure up to eight query queues and set the number of queries that can run in each of those queues concurrently. You can set up rules to route queries to particular queues based on the user running the query or labels that you specify. You can also configure the amount of memory allocated to each queue, so that large queries run in queues with more memory than other queues. You can also configure a query monitoring rule (QMR) to limit long-running queries. For more information, see Implementing manual WLM.

    注意

    We recommend configuring your manual WLM query queues with a total of 15 or fewer query slots. For more information, see Concurrency level.