ignite-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nikolay Izhikov <nizhi...@apache.org>
Subject [DISCUSSION][IEP-39] Management API to cancel user provided tasks and queries.
Date Tue, 04 Feb 2020 15:07:15 GMT
Hello, Igniters.

I propose to create management API to dance user provided tasks and queries.
Below my proposal in the IEP [1] form.

Please, share your feedback.


Motivation:

    Ignite provides many API to deploy and execute user-provided code on the server nodes
    inside the sam JVM as Ignite process runs.

    We also has a many APIs that allocate many resources on the server nodes:

    In case of some buggy code that consumes many system resources(CPU, RAM, flood network)
or heavy query
    the whole cluster can becomes instable.
    We should provide to the cluster administator the ability to stop any user deployed task.

Description:
    JMX beans to cancel listed tasks should be introduced:
        * Compute task
        * Service
        * Continuous query
        * Transactions
        * Queries(SQL, Scan, Text)

    In the scope of IEP-35 System view API introduced.
    New API should use the same identifier that is used in corresponding System View.

Public API changes:
    * Cancel of Scan(text) queries should work similar to the SQL.
    * Cancel of compute task should invoke `ComputeTaskInternalFuture#cancel` for the corresponding
task.
    * Cancel of service should be the same as `IgniteServices#cancel`
    * Cancel of transaction should works the same as in `TransactionMXBean#getActiveTransaction(kill=true)`.
    * Cancel of a continuous query should work the same as `QueryCursor#close` execution.

```
    QueryMXBean {
        boolean cancelSQL(Long queryId); //Already implemented in IGNITE-4436.

        boolean cancelScan(Long queryId);

        boolean cancelText(Long queryId);
    }   

    ComputeMXBean {
        boolean cancel(IgniteUuid id);
    }   
    
    ServiceMXBean {
        boolean cancel(IgniteUuid id);
    }   

    TransactionMXBean {
        boolean cancel(IgniteUuid xid);
    }

    interface ContinuousQueryMXBean {
        boolean cancel(UUID id);
    }
```

[1] https://cwiki.apache.org/confluence/pages/viewpage.action?pageId=145724615



> 17 янв. 2020 г., в 22:43, Николай Ижиков <nizhikov.dev@gmail.com>
написал(а):
> 
> Hello, Andrey.
> 
> Thanks for positive feedback.
> Appreciate it.
> 
>> we can't cancel service or service's method
> 
> I understand it. 
> Seems, we have several obvious options here:
> 
> * Try to do it and if fail answer to the user: «I’ve tried and fail. Sorry»
> * Kill hanging thread.
> 
>> This invocations not register anywhere and can't be tracked and killed.
> 
> Yes.
> So we should invent tracking for those invocation to be able to kill it :)
> 
> 
>> 17 янв. 2020 г., в 21:03, Andrey Gura <agura@apache.org> написал(а):
>> 
>> It would be grate.
>> 
>> Only one comment: we can't cancel service or service's method
>> execution because service grid API doesn't imply any requirement to
>> service implementation. So if user do something like infinite cycle or
>> blocking but non-interruptible operation it's impossible to interrupt
>> it. Also service method invocation itself isn't cluster wide or local
>> node specific operation. This invocations not register anywhere and
>> can't be tracked and killed.
>> 
>> Unfortunately, the same is valid for some jobs in sense of infinite or
>> non-interruptible operations.
>> 
>> On Wed, Jan 15, 2020 at 9:30 PM Николай Ижиков <nizhikov@apache.org>
wrote:
>>> 
>>> Hello, Igniters.
>>> 
>>> As you may know, we put a lot of effort to improve Ignite metric and diagnostic
API.
>>> We have created the following API:
>>>   * Metric manager
>>>   * System view manager
>>> As far as I know, we would have tracing capabilities soon.
>>> 
>>> I think it's time to take the next step.
>>> We should provide to the administrator the API to cancel(stop, kill) arbitrary
user started computation.
>>> 
>>> Right now we have API to do it for:
>>>   * transactions `TransactionsMXBean#getActiveTransactions`.
>>>   * SQL queries: `KILL QUERY` sql command and visor task - `VisorQueryCancelTask`
>>> 
>>> Please, note, these features are implemented via different API.
>>> 
>>> I think we should introduce uniform Cancel API for the following computations:
>>> 
>>>   * service.
>>>   * specific service method execution.
>>>   * compute job(compute task).
>>>   * query(scan, continuous, text).
>>> 
>>> We should  also rework kill transaction and kill SQL queries API to make them
similar to each other.
>>> I have plans to write an IEP for it and implement it.
>>> What do you think?
>>> 
> 


Mime
View raw message