Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id DD1E7200BBF for ; Mon, 14 Nov 2016 13:15:05 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id DBA6F160B06; Mon, 14 Nov 2016 12:15:05 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 07744160B05 for ; Mon, 14 Nov 2016 13:15:04 +0100 (CET) Received: (qmail 2945 invoked by uid 500); 14 Nov 2016 12:15:04 -0000 Mailing-List: contact user-help@ignite.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@ignite.apache.org Delivered-To: mailing list user@ignite.apache.org Received: (qmail 2935 invoked by uid 99); 14 Nov 2016 12:15:04 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd1-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 14 Nov 2016 12:15:04 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd1-us-west.apache.org (ASF Mail Server at spamd1-us-west.apache.org) with ESMTP id B7941C18E7 for ; Mon, 14 Nov 2016 12:15:03 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 2.379 X-Spam-Level: ** X-Spam-Status: No, score=2.379 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HTML_MESSAGE=2, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, RCVD_IN_SORBS_SPAM=0.5, SPF_PASS=-0.001] autolearn=disabled Authentication-Results: spamd1-us-west.apache.org (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd1-us-west.apache.org [10.40.0.7]) (amavisd-new, port 10024) with ESMTP id Yb_Hd7EQidfw for ; Mon, 14 Nov 2016 12:15:01 +0000 (UTC) Received: from mail-yw0-f181.google.com (mail-yw0-f181.google.com [209.85.161.181]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTPS id A16165F307 for ; Mon, 14 Nov 2016 12:15:00 +0000 (UTC) Received: by mail-yw0-f181.google.com with SMTP id i145so55695851ywg.2 for ; Mon, 14 Nov 2016 04:15:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to; bh=4edADd65KtaLguQo8CZGn5fjQAYv43PPFanAV7Q/sJs=; b=cQuR+Mn6G3nDA1GMzMZXvMnVC0PgpvyU6JSmzjvqxAz/zEG6vlLQYstcB2PNU9oOMW V/kLIw8XDv9ZetOH+abYWCZXMg1A+bYej9xYBI5gW3JlbQPnkVEcx1tEuvZmwo8V/DVI nxYaA3f+xXAYvZTfqcmt6lR6dq54dfLLkmMnGp9moRRmiPldTvSKRk/OFVb0qWjhjOp1 QlecrQBj4hhzNUzTra76FMUwd87ofuNqiDkLhlrtZyX0FrYAKmVnQD2GDt/tpRKpZJpO ZwYn/+dR0y6rt53nWqmQwJc7fJLWFy2rixkAL4wMWCD/elQLlfiT4qTL0UiajxaWCYrC vkJA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to; bh=4edADd65KtaLguQo8CZGn5fjQAYv43PPFanAV7Q/sJs=; b=OfWRYzKiQ9KtHv7sfoBswJhSEOVHAisaR/zFmt/KzWYQxRr1MyRmGkOIehBeSHVY2E 8MatMF3QY9ftfIIwBrh1AW9Bpmh1TTGrfPbSm/uP4Y0Dn09M/Ju4AaxIaYAglTPI4hwq ZD3sipAwHkndVTrHeAtLQ67Q7L8b8I1kvhtGQnj+uIJ+YAKqBXq/baRWAJfOUB/naCKw sGGZ17qh9Erfy4+hyV+ZUIVHk6iYFgNjXYsEMXU+VsghvT1SsMvZaUuoVcMU21eEEACu q7vqJ5xgr91hh/Q2R6GQdw893hPjllPnl3/I/xgBblrt4YsGLAn6TltRUaX0wwNVLh9Y jWUA== X-Gm-Message-State: ABUngvdkLEIqg+s3YcO/x5t5rwHzRrw+XpSrS3tTyPPUJvPKkHGZKRYEnhZb/GjdgfGTGpUZTjAfz7Qi9Sdeaw== X-Received: by 10.129.164.198 with SMTP id b189mr13347730ywh.294.1479125699546; Mon, 14 Nov 2016 04:14:59 -0800 (PST) MIME-Version: 1.0 Received: by 10.37.171.195 with HTTP; Mon, 14 Nov 2016 04:14:59 -0800 (PST) In-Reply-To: <1479123354282-8939.post@n6.nabble.com> References: <1479114984128-8934.post@n6.nabble.com> <1479121022925-8938.post@n6.nabble.com> <1479123354282-8939.post@n6.nabble.com> From: Vladislav Pyatkov Date: Mon, 14 Nov 2016 15:14:59 +0300 Message-ID: Subject: Re: Remote Server Thread Not exit when Job finished,Cause out of memory To: user@ignite.apache.org Content-Type: multipart/alternative; boundary=94eb2c129c78e65398054141c984 archived-at: Mon, 14 Nov 2016 12:15:06 -0000 --94eb2c129c78e65398054141c984 Content-Type: text/plain; charset=UTF-8 Hi Alex, You should do like this: IgniteCompute compute = ignite.compute().withAsync(); compute.apply(...) IgniteFuture future = compute.future(); ... future.cancel(); And handle Thread.interrupted() flag into closure. On Mon, Nov 14, 2016 at 2:35 PM, alex wrote: > Thanks vdpyatkov. > > Currently, the number of threads is not the problem. > > The problem is that when client finished, how to finish threads on server > node which created by this client. > > For example, client code is: > > String cacheKey = "jobIds"; > String cname = "myCacheName"; > ClusterGroup rmts =ignite.cluster().forRemotes(); > IgniteCache> cache = ignite.getOrCreateCache(cname) > ; > List jobList = cache.get(cacheKey); > Collection res = ignite.compute(rmts).apply( > new IgniteClosure() { > @Override > public String apply(String word) { > return word; > } > }, > jobList > ); > ignite.close(); > System.out.println("ignite Closed"); > > if (res == null) { > System.out.println("Error: Result is null"); > return; > } > > res.forEach(s -> { > System.out.println(s); > }); > System.out.println("Finished!"); > > > When client initiate ignite instance, server side create 6 threads for this > computing job. > After client program exit, the 6 threads still alive on server. And never > exit until I kill the server. > How can I finish threads after client job finished gracefully. > > Thanks for any suggestions > > > vdpyatkov wrote > > Hi Alex, > > I think, these threads are executing into pools of threads, and number of > > threads always restricted by pool size[1]. > > You can configure sizes manually: > > > > > > > > > > > > [1]: > > https://apacheignite.readme.io/v1.7/docs/performance-tips# > configure-thread-pools > > > vdpyatkov wrote > > Hi Alex, > > I think, these threads are executing into pools of threads, and number of > > threads always restricted by pool size[1]. > > You can configure sizes manually: > > > > > > > > > > > > [1]: > > https://apacheignite.readme.io/v1.7/docs/performance-tips# > configure-thread-pools > > > > > > -- > View this message in context: http://apache-ignite-users. > 70518.x6.nabble.com/Remote-Server-Thread-Not-exit-when- > Job-finished-Cause-out-of-memory-tp8934p8939.html > Sent from the Apache Ignite Users mailing list archive at Nabble.com. > -- Vladislav Pyatkov --94eb2c129c78e65398054141c984 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Hi Alex,

You should do = like this:

IgniteCompute compute =3D ignite.comput= e().withAsync();
compute.apply(...)
IgniteFuture future= =3D compute.future();
...
future.cancel();
<= br>
And handle Thread.interrupted() flag into closure.

On Mon, No= v 14, 2016 at 2:35 PM, alex <alexwang58@gmail.com> wrote:=
Thanks vdpyatkov.

Currently, the number of threads is not the problem.

The problem is that when client finished, how to finish threads on server node which created by this client.

For example, client code is:

String cacheKey =3D "jobIds";
String cname =3D "myCacheName";
ClusterGroup rmts =3Dignite.cluster().forRemotes();
IgniteCache<String, List&lt;String>> cache =3D ignite.getOrCre= ateCache(cname);
List<String> jobList =3D cache.get(cacheKey);
Collection<String> res =3D ignite.compute(rmts).apply(
=C2=A0 =C2=A0 =C2=A0 =C2=A0 new IgniteClosure<String, String>() {
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 @Override
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 public String apply(String word) = {
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 return word;
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 }
=C2=A0 =C2=A0 =C2=A0 =C2=A0 },
=C2=A0 =C2=A0 =C2=A0 =C2=A0 jobList
);
ignite.close();
System.out.println("ignite Closed");

if (res =3D=3D null) {
=C2=A0 =C2=A0 System.out.println("Error: Result is null");
=C2=A0 =C2=A0 return;
}

res.forEach(s -> {
=C2=A0 =C2=A0 System.out.println(s);
});
System.out.println("Finished!");


When client initiate ignite instance, server side create 6 threads for this=
computing job.
After client program exit,=C2=A0 the 6 threads still alive on server. And n= ever
exit until I kill the server.
How can I finish threads after client job finished gracefully.

Thanks for any suggestions


vdpyatkov wrote
> Hi Alex,
> I think, these threads are executing into pools of threads, and number= of
> threads always restricted by pool size[1].
> You can configure sizes manually:
>
>
> <property name=3D"marshallerCacheThreadPoolSize" val= ue=3D"12"/>
>
> <property name=3D"utilityCachePoolSize" value=3D"12&= quot;/>
> [1]:
> https://apachei= gnite.readme.io/v1.7/docs/performance-tips#configure-thread-pools=


vdpyatkov wrote
> Hi Alex,
> I think, these threads are executing into pools of threads, and number= of
> threads always restricted by pool size[1].
> You can configure sizes manually:
>
>
> <property name=3D"marshallerCacheThreadPoolSize" val= ue=3D"12"/>
>
> <property name=3D"utilityCachePoolSize" value=3D"12&= quot;/>
> [1]:
> https://apachei= gnite.readme.io/v1.7/docs/performance-tips#configure-thread-pools=





--
View this message in context: http://= apache-ignite-users.70518.x6.nabble.com/Remote-Server-Thread-Not-= exit-when-Job-finished-Cause-out-of-memory-tp8934p8939.html
Sent from the Apache Ignite Users m= ailing list archive at Nabble.com.



--
=
Vladislav= Pyatkov
--94eb2c129c78e65398054141c984--