Re: [akka-user] Akka, Akka Typed and dead code elimination

2018-02-02 Thread Christopher Hunt
Hi Roland,

> On 3 Feb 2018, at 5:56 pm, Roland Kuhn  wrote:
> 
> I agree on the tendency. In the case of Akka there are two reasons for using 
> reflection and neither of them is caused by a lack of static types: 
> extensibility and remote marshaling. A new implementation could remove 
> configuration and skip serialization for the local case—in fact that was done 
> in my approach. Perhaps reviving that would solve your issue.
> 
Sounds good to me. :-)

As a slight aside, I think that my general position is that no matter how many 
resources are available to a system, or what the perceived security 
requirements are, dead code elimination is going to become necessary in order 
for the JVM to continue competing against LLVM and other native, linking style 
targets (hence Graal AOT perhaps). For one thing, the more that I can run on a 
single machine, the less my costs are in terms of the machine’s specs.

Thanks for the discussion.

Cheers,
-C

-- 
>>  Read the docs: http://akka.io/docs/
>>  Check the FAQ: 
>> http://doc.akka.io/docs/akka/current/additional/faq.html
>>  Search the archives: https://groups.google.com/group/akka-user
--- 
You received this message because you are subscribed to the Google Groups "Akka 
User List" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to akka-user+unsubscr...@googlegroups.com.
To post to this group, send email to akka-user@googlegroups.com.
Visit this group at https://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.


Re: [akka-user] Akka, Akka Typed and dead code elimination

2018-02-02 Thread Roland Kuhn


Sent from my iPhone

> On 3. Feb 2018, at 07:25, Christopher Hunt  wrote:
> 
> Hi Roland,
> 
>> On 3 Feb 2018, at 5:16 pm, Roland Kuhn  wrote:
>> 
>> could you elaborate on how exactly Akka Typed is expected to help with your 
>> use-case? The only difference I can see is that the new (and currently 
>> removed) implementation contained fewer extension points, but that is 
>> unrelated to whether ActorRef has a type parameter or not.
>> 
> Perhaps Akka Typed doesn’t/wouldn’t help. I only mention it because I feel 
> that the more strongly typed things are, the less use of reflection and other 
> dynamic behaviour there tends to be.

I agree on the tendency. In the case of Akka there are two reasons for using 
reflection and neither of them is caused by a lack of static types: 
extensibility and remote marshaling. A new implementation could remove 
configuration and skip serialization for the local case—in fact that was done 
in my approach. Perhaps reviving that would solve your issue.

Regards, Roland 

> 
> Cheers,
> -C
> -- 
> >> Read the docs: http://akka.io/docs/
> >> Check the FAQ: 
> >> http://doc.akka.io/docs/akka/current/additional/faq.html
> >> Search the archives: https://groups.google.com/group/akka-user
> --- 
> You received this message because you are subscribed to the Google Groups 
> "Akka User List" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to akka-user+unsubscr...@googlegroups.com.
> To post to this group, send email to akka-user@googlegroups.com.
> Visit this group at https://groups.google.com/group/akka-user.
> For more options, visit https://groups.google.com/d/optout.

-- 
>>  Read the docs: http://akka.io/docs/
>>  Check the FAQ: 
>> http://doc.akka.io/docs/akka/current/additional/faq.html
>>  Search the archives: https://groups.google.com/group/akka-user
--- 
You received this message because you are subscribed to the Google Groups "Akka 
User List" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to akka-user+unsubscr...@googlegroups.com.
To post to this group, send email to akka-user@googlegroups.com.
Visit this group at https://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.


Re: [akka-user] Akka, Akka Typed and dead code elimination

2018-02-02 Thread Christopher Hunt
Hi Roland,

> On 3 Feb 2018, at 5:16 pm, Roland Kuhn  wrote:
> 
> could you elaborate on how exactly Akka Typed is expected to help with your 
> use-case? The only difference I can see is that the new (and currently 
> removed) implementation contained fewer extension points, but that is 
> unrelated to whether ActorRef has a type parameter or not.
> 
Perhaps Akka Typed doesn’t/wouldn’t help. I only mention it because I feel that 
the more strongly typed things are, the less use of reflection and other 
dynamic behaviour there tends to be.

Cheers,
-C

-- 
>>  Read the docs: http://akka.io/docs/
>>  Check the FAQ: 
>> http://doc.akka.io/docs/akka/current/additional/faq.html
>>  Search the archives: https://groups.google.com/group/akka-user
--- 
You received this message because you are subscribed to the Google Groups "Akka 
User List" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to akka-user+unsubscr...@googlegroups.com.
To post to this group, send email to akka-user@googlegroups.com.
Visit this group at https://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.


Re: [akka-user] Akka, Akka Typed and dead code elimination

2018-02-02 Thread Roland Kuhn
Hi Christopher,

could you elaborate on how exactly Akka Typed is expected to help with your 
use-case? The only difference I can see is that the new (and currently removed) 
implementation contained fewer extension points, but that is unrelated to 
whether ActorRef has a type parameter or not.

Regards, Roland 

Sent from my iPhone

> On 3. Feb 2018, at 06:03, Christopher Hunt  wrote:
> 
> Thanks for the reply Konrad.
> 
> Although my use-case is somewhat forced by working with constrained device 
> memory and enterprise security, I think that there’s a broader concern. My 
> understanding is that the JVM is embracing ahead of time compilation and the 
> potential for dead code elimination during the linking phase. I would think 
> that most forms of reflection would be at odds to that. Shouldn’t Akka 
> therefore be re-considering its position on its use of reflection, and might 
> Akka Typed be a way forward in that regard?
> 
> Cheers,
> -C
> 
>> On 3 Feb 2018, at 3:43 pm, Konrad “ktoso” Malawski 
>>  wrote:
>> 
>> Hi Christopher,
>> I’ve worked in the past on an Scala on Android project, so have had the 
>> “pleasure” of battling proguard for similar reasons.
>> In general I guess the “core stuff” needs to be kept, which would mostly be 
>> the akka.actor and dungeon things.
>> 
>> AFAIR proguard is ale to understand references via “classOf” etc, so user 
>> land actors should be fine. Typed actors also should be nicer to proguard.
>> The only things we’d need to specifically exclude from removal is things 
>> that have classnames defined in configuration,
>> that’ll mostly e mailoxes, perhaps the remoting infra etc.
>> 
>> I guess it can be useful to have a config that is “known to work”, but I 
>> don’t think it is realistic to fully know that “this will work for 
>> everyone”, after all, you’re removing code.
>> If you want to provide the core set of excludes, that sounds useful. We in 
>> the time are unlikely to have the time to maintain or help much with this 
>> though.
>> 
>> -- 
>> Cheers,
>> Konrad 'ktoso' Malawski
>> Akka @ Lightbend
>> 
>>> On February 3, 2018 at 13:31:35, Christopher Hunt (hunt...@gmail.com) wrote:
>>> 
>>> Hi everyone, 
>>> 
>>> I’ve got a requirement to run services on machines with limited resources, 
>>> memory in particular, but also disk (disk == memory for my use case!) In 
>>> addition, I wish to reduce the attack surface area of a service by 
>>> eliminating code that isn’t used. 
>>> 
>>> I’d therefore like to take a unikernal-style of approach to my services 
>>> which, of course, use Akka. Using Proguard on my service very quickly 
>>> revealed problems relating to Akka. From looking through past posts, it 
>>> seems that the use of Proguard has been a discussion relating to Android 
>>> (which also hasn’t helped me around the issues I’ve been having). 
>>> 
>>> Would there be any interest in seeing Akka become more suitable for dead 
>>> code elimination, particularly with the advent of Akka Typed? (reflection 
>>> and dead code elimination are at odds with each other) 
>>> 
>>> Having an official project declaration of what classes should be kept for 
>>> dead code elimination, and an integration build verifying this to a degree 
>>> is what I’m thinking. I’d be happy contribute a PR with a little help. 
>>> 
>>> Cheers  
>>> C 
>>> 
>>> --  
>>> >> Read the docs: http://akka.io/docs/ 
>>> >> Check the FAQ: 
>>> >> http://doc.akka.io/docs/akka/current/additional/faq.html 
>>> >> Search the archives: https://groups.google.com/group/akka-user 
>>> ---  
>>> You received this message because you are subscribed to the Google Groups 
>>> "Akka User List" group. 
>>> To unsubscribe from this group and stop receiving emails from it, send an 
>>> email to akka-user+unsubscr...@googlegroups.com. 
>>> To post to this group, send email to akka-user@googlegroups.com. 
>>> Visit this group at https://groups.google.com/group/akka-user. 
>>> For more options, visit https://groups.google.com/d/optout. 
> 
> -- 
> >> Read the docs: http://akka.io/docs/
> >> Check the FAQ: 
> >> http://doc.akka.io/docs/akka/current/additional/faq.html
> >> Search the archives: https://groups.google.com/group/akka-user
> --- 
> You received this message because you are subscribed to the Google Groups 
> "Akka User List" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to akka-user+unsubscr...@googlegroups.com.
> To post to this group, send email to akka-user@googlegroups.com.
> Visit this group at https://groups.google.com/group/akka-user.
> For more options, visit https://groups.google.com/d/optout.

-- 
>>  Read the docs: http://akka.io/docs/
>>  Check the FAQ: 
>> http://doc.akka.io/docs/akka/current/additional/faq.html
>>  Search the archives: https://groups.google.com/group/akka-user
--- 

Re: [akka-user] Akka, Akka Typed and dead code elimination

2018-02-02 Thread Konrad “ktoso” Malawski
Really Christopher… we’re not heavy on reflection, check other libraries in
the Java ecosystem ;-)

The single reflection things we have is classOf style actor creation, and
initial startup things, that’s it.

-- 
Cheers,
Konrad 'ktoso ' Malawski
Akka  @ Lightbend 

On February 3, 2018 at 14:04:07, Christopher Hunt (hunt...@gmail.com) wrote:

Thanks for the reply Konrad.

Although my use-case is somewhat forced by working with constrained device
memory and enterprise security, I think that there’s a broader concern. My
understanding is that the JVM is embracing ahead of time compilation and
the potential for dead code elimination during the linking phase. I would
think that most forms of reflection would be at odds to that. Shouldn’t
Akka therefore be re-considering its position on its use of reflection, and
might Akka Typed be a way forward in that regard?

Cheers,
-C

On 3 Feb 2018, at 3:43 pm, Konrad “ktoso” Malawski <
konrad.malaw...@lightbend.com> wrote:

Hi Christopher,
I’ve worked in the past on an Scala on Android project, so have had the
“pleasure” of battling proguard for similar reasons.
In general I guess the “core stuff” needs to be kept, which would mostly be
the akka.actor and dungeon things.

AFAIR proguard is ale to understand references via “classOf” etc, so user
land actors should be fine. Typed actors also should be nicer to proguard.
The only things we’d need to specifically exclude from removal is things
that have classnames defined in configuration,
that’ll mostly e mailoxes, perhaps the remoting infra etc.

I guess it can be useful to have a config that is “known to work”, but I
don’t think it is realistic to fully know that “this will work for
everyone”, after all, you’re removing code.
If you want to provide the core set of excludes, that sounds useful. We in
the time are unlikely to have the time to maintain or help much with this
though.

-- 
Cheers,
Konrad 'ktoso ' Malawski
Akka  @ Lightbend 

On February 3, 2018 at 13:31:35, Christopher Hunt (hunt...@gmail.com) wrote:

Hi everyone,

I’ve got a requirement to run services on machines with limited resources,
memory in particular, but also disk (disk == memory for my use case!) In
addition, I wish to reduce the attack surface area of a service by
eliminating code that isn’t used.

I’d therefore like to take a unikernal-style of approach to my services
which, of course, use Akka. Using Proguard on my service very quickly
revealed problems relating to Akka. From looking through past posts, it
seems that the use of Proguard has been a discussion relating to Android
(which also hasn’t helped me around the issues I’ve been having).

Would there be any interest in seeing Akka become more suitable for dead
code elimination, particularly with the advent of Akka Typed? (reflection
and dead code elimination are at odds with each other)

Having an official project declaration of what classes should be kept for
dead code elimination, and an integration build verifying this to a degree
is what I’m thinking. I’d be happy contribute a PR with a little help.

Cheers
C

--
>> Read the docs: http://akka.io/docs/
>> Check the FAQ:
http://doc.akka.io/docs/akka/current/additional/faq.html
>> Search the archives: https://groups.google.com/group/akka-user
---
You received this message because you are subscribed to the Google Groups
"Akka User List" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to akka-user+unsubscr...@googlegroups.com.
To post to this group, send email to akka-user@googlegroups.com.
Visit this group at https://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.

-- 
>>  Read the docs: http://akka.io/docs/
>>  Check the FAQ: 
>> http://doc.akka.io/docs/akka/current/additional/faq.html
>>  Search the archives: https://groups.google.com/group/akka-user
--- 
You received this message because you are subscribed to the Google Groups "Akka 
User List" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to akka-user+unsubscr...@googlegroups.com.
To post to this group, send email to akka-user@googlegroups.com.
Visit this group at https://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.


Re: [akka-user] Akka, Akka Typed and dead code elimination

2018-02-02 Thread Christopher Hunt
Thanks for the reply Konrad.

Although my use-case is somewhat forced by working with constrained device 
memory and enterprise security, I think that there’s a broader concern. My 
understanding is that the JVM is embracing ahead of time compilation and the 
potential for dead code elimination during the linking phase. I would think 
that most forms of reflection would be at odds to that. Shouldn’t Akka 
therefore be re-considering its position on its use of reflection, and might 
Akka Typed be a way forward in that regard?

Cheers,
-C

> On 3 Feb 2018, at 3:43 pm, Konrad “ktoso” Malawski 
>  wrote:
> 
> Hi Christopher,
> I’ve worked in the past on an Scala on Android project, so have had the 
> “pleasure” of battling proguard for similar reasons.
> In general I guess the “core stuff” needs to be kept, which would mostly be 
> the akka.actor and dungeon things.
> 
> AFAIR proguard is ale to understand references via “classOf” etc, so user 
> land actors should be fine. Typed actors also should be nicer to proguard.
> The only things we’d need to specifically exclude from removal is things that 
> have classnames defined in configuration,
> that’ll mostly e mailoxes, perhaps the remoting infra etc.
> 
> I guess it can be useful to have a config that is “known to work”, but I 
> don’t think it is realistic to fully know that “this will work for everyone”, 
> after all, you’re removing code.
> If you want to provide the core set of excludes, that sounds useful. We in 
> the time are unlikely to have the time to maintain or help much with this 
> though.
> 
> -- 
> Cheers,
> Konrad 'ktoso ' Malawski
> Akka  @ Lightbend 
> On February 3, 2018 at 13:31:35, Christopher Hunt (hunt...@gmail.com 
> ) wrote:
> 
>> Hi everyone, 
>> 
>> I’ve got a requirement to run services on machines with limited resources, 
>> memory in particular, but also disk (disk == memory for my use case!) In 
>> addition, I wish to reduce the attack surface area of a service by 
>> eliminating code that isn’t used. 
>> 
>> I’d therefore like to take a unikernal-style of approach to my services 
>> which, of course, use Akka. Using Proguard on my service very quickly 
>> revealed problems relating to Akka. From looking through past posts, it 
>> seems that the use of Proguard has been a discussion relating to Android 
>> (which also hasn’t helped me around the issues I’ve been having). 
>> 
>> Would there be any interest in seeing Akka become more suitable for dead 
>> code elimination, particularly with the advent of Akka Typed? (reflection 
>> and dead code elimination are at odds with each other) 
>> 
>> Having an official project declaration of what classes should be kept for 
>> dead code elimination, and an integration build verifying this to a degree 
>> is what I’m thinking. I’d be happy contribute a PR with a little help. 
>> 
>> Cheers  
>> C 
>> 
>> --  
>> >> Read the docs: http://akka.io/docs/  
>> >> Check the FAQ: 
>> >> http://doc.akka.io/docs/akka/current/additional/faq.html 
>> >>  
>> >> Search the archives: https://groups.google.com/group/akka-user 
>> >>  
>> ---  
>> You received this message because you are subscribed to the Google Groups 
>> "Akka User List" group. 
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to akka-user+unsubscr...@googlegroups.com 
>> . 
>> To post to this group, send email to akka-user@googlegroups.com 
>> . 
>> Visit this group at https://groups.google.com/group/akka-user 
>> . 
>> For more options, visit https://groups.google.com/d/optout 
>> . 

-- 
>>  Read the docs: http://akka.io/docs/
>>  Check the FAQ: 
>> http://doc.akka.io/docs/akka/current/additional/faq.html
>>  Search the archives: https://groups.google.com/group/akka-user
--- 
You received this message because you are subscribed to the Google Groups "Akka 
User List" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to akka-user+unsubscr...@googlegroups.com.
To post to this group, send email to akka-user@googlegroups.com.
Visit this group at https://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.


Re: [akka-user] Akka, Akka Typed and dead code elimination

2018-02-02 Thread Konrad “ktoso” Malawski
Hi Christopher,
I’ve worked in the past on an Scala on Android project, so have had the
“pleasure” of battling proguard for similar reasons.
In general I guess the “core stuff” needs to be kept, which would mostly be
the akka.actor and dungeon things.

AFAIR proguard is ale to understand references via “classOf” etc, so user
land actors should be fine. Typed actors also should be nicer to proguard.
The only things we’d need to specifically exclude from removal is things
that have classnames defined in configuration,
that’ll mostly e mailoxes, perhaps the remoting infra etc.

I guess it can be useful to have a config that is “known to work”, but I
don’t think it is realistic to fully know that “this will work for
everyone”, after all, you’re removing code.
If you want to provide the core set of excludes, that sounds useful. We in
the time are unlikely to have the time to maintain or help much with this
though.

-- 
Cheers,
Konrad 'ktoso ' Malawski
Akka  @ Lightbend 

On February 3, 2018 at 13:31:35, Christopher Hunt (hunt...@gmail.com) wrote:

Hi everyone,

I’ve got a requirement to run services on machines with limited resources,
memory in particular, but also disk (disk == memory for my use case!) In
addition, I wish to reduce the attack surface area of a service by
eliminating code that isn’t used.

I’d therefore like to take a unikernal-style of approach to my services
which, of course, use Akka. Using Proguard on my service very quickly
revealed problems relating to Akka. From looking through past posts, it
seems that the use of Proguard has been a discussion relating to Android
(which also hasn’t helped me around the issues I’ve been having).

Would there be any interest in seeing Akka become more suitable for dead
code elimination, particularly with the advent of Akka Typed? (reflection
and dead code elimination are at odds with each other)

Having an official project declaration of what classes should be kept for
dead code elimination, and an integration build verifying this to a degree
is what I’m thinking. I’d be happy contribute a PR with a little help.

Cheers
C

-- 
>> Read the docs: http://akka.io/docs/
>> Check the FAQ:
http://doc.akka.io/docs/akka/current/additional/faq.html
>> Search the archives: https://groups.google.com/group/akka-user
---
You received this message because you are subscribed to the Google Groups
"Akka User List" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to akka-user+unsubscr...@googlegroups.com.
To post to this group, send email to akka-user@googlegroups.com.
Visit this group at https://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.

-- 
>>  Read the docs: http://akka.io/docs/
>>  Check the FAQ: 
>> http://doc.akka.io/docs/akka/current/additional/faq.html
>>  Search the archives: https://groups.google.com/group/akka-user
--- 
You received this message because you are subscribed to the Google Groups "Akka 
User List" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to akka-user+unsubscr...@googlegroups.com.
To post to this group, send email to akka-user@googlegroups.com.
Visit this group at https://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.