|
mysqlnd_ms_set_qos(Информация о версии неизвестна, возможно, только в SVN) mysqlnd_ms_set_qos — Sets the quality of service needed from the cluster Описание
bool
mysqlnd_ms_set_qos
( mixed $connection
, int $service_level
[, int $service_level_option
[, mixed $option_value
]] )
Sets the quality of service needed from the cluster. A database cluster delivers a certain quality of service to the user depending on its architecture. A major aspect of the quality of service is the consistency level the cluster can offer. An asynchronous MySQL replication cluster defaults to eventual consistency for slave reads: a slave may serve stale data, current data or it may have not the requested data at all, because it is not synchronous to the master. In a MySQL replication cluster only master accesses can give strong consistency, which promises that all clients see each others changes. PECL/mysqlnd_ms hides the complexity of choosing appropriate nodes to achieve a certain level of service from the cluster. The quality of service filter implements the necessary logic. The filter can either be configured in the plugins configuration file or at run time using mysqlnd_ms_set_qos(). Similar results can be achieved with PECL mysqlnd_ms < 1.2.0, if using SQL hints to force the use of a certain type of node or using the master_on_write plugin configuration option. The first requires more code and causes more work on the application side. The latter is coarser than using the quality of service filter. Settings made through the function call can be reversed, as shown in the example below. The example temporarily switches to a higher service level (session consistency, read your writes) and returns back to the clusters default after it has performed all operations that require the better service. This way, read load on the master can be minimized compared to using master_on_write, which would continue using the master after the first write. Список параметров
Возвращаемые значенияReturns TRUE if the connections service level has been switched to the requested. Otherwise, returns FALSE Примечания
Примеры
Пример #1 mysqlnd_ms_set_qos() example
<?php Смотрите также
|
|