Seamless - send collections by value

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Seamless - send collections by value

Petr Fischer
Hello, I am testing Seamless project (https://github.com/dionisiydk/Seamless) but I did not understand one thing:

I have (for example) a Person class in my server and client image. Person class implements:

Person>>sseamlessDefaultTransferStrategy
        ^SeamlessTransferStrategy defaultByValue

so all Person instances are serialized from server to client image. Good.

But when I have server method, for example, getPersons, that returns a collection (OrderedCollection) of Person instances, this collection is passed by reference (or not?).
OrderedCollection inherits transfer strategy from Object, which is "by reference".

So in client image, when I iterate this collection, too many (thousands) requests occurs.

How to manage only this specific collection (returned from getPersons) to pass by value from server to client (to be completely serialized and copied to the client image), so when I iterate this collection in client image to avoid additional network requests (proxying)?

Thanks! pf

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Seamless - send collections by value

Denis Kudriashov
Hi Petr.

There are few solutions to your problem.

1) You can specify #value strategy for any collections for your network instance:

network transferByValue: (Kind of: Collection)

For your example you need to apply this strategy on server side. In that case client will continue send collections by reference but it will receive collections by value from server.
 
2) You can specify value strategy for BlockClosure. It will perform #select: (for example) on server side without requests to client.

network transferByValue: (Instance of: BlockClosure)

Here you will need to apply strategy on client because blocks will be sent from client to server.

3) You can explicitly pass objects with value strategy:

YourService>>getPersons
"on server side"
^retrievePersons asTransferredByValue

4) If persons collection is instance variable of other transferred by value object then you can specify what value means for this container:

PersonContainer>>prepareValueTransferBy: aSeamlessObjectTransporter

aSeamlessObjectTransporter transferByValue: contents

5) You can ask any proxy to load local copy of remote object:

proxy asLocalObject.
  
Important notice: 
- Seamless has no distributed garbage collection. So if you will transfer by reference temporary objects they will be not collected as garbage. For example server could  compute something and return it by reference. Nobody will kill it.
But if you share only long lived service then it is not problem for you.
- there is no security in the level of Seamless. You should organize secure channel by external tools like VPN.

These features are in todo.

Best regards, 
Denis


2017-07-13 18:21 GMT+02:00 Petr Fischer <[hidden email]>:
Hello, I am testing Seamless project (https://github.com/dionisiydk/Seamless) but I did not understand one thing:

I have (for example) a Person class in my server and client image. Person class implements:

Person>>sseamlessDefaultTransferStrategy
        ^SeamlessTransferStrategy defaultByValue

so all Person instances are serialized from server to client image. Good.

But when I have server method, for example, getPersons, that returns a collection (OrderedCollection) of Person instances, this collection is passed by reference (or not?).
OrderedCollection inherits transfer strategy from Object, which is "by reference".

So in client image, when I iterate this collection, too many (thousands) requests occurs.

How to manage only this specific collection (returned from getPersons) to pass by value from server to client (to be completely serialized and copied to the client image), so when I iterate this collection in client image to avoid additional network requests (proxying)?

Thanks! pf


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Seamless - send collections by value

Denis Kudriashov
Also try SeamlessLogger to profile remote communication:

SeamlessLogger startAfresh 

All remote messages will be written into transcript. And you can analyze full statistics:

SeamlessLogger collectStatistics inspect.


2017-07-14 14:04 GMT+02:00 Denis Kudriashov <[hidden email]>:
Hi Petr.

There are few solutions to your problem.

1) You can specify #value strategy for any collections for your network instance:

network transferByValue: (Kind of: Collection)

For your example you need to apply this strategy on server side. In that case client will continue send collections by reference but it will receive collections by value from server.
 
2) You can specify value strategy for BlockClosure. It will perform #select: (for example) on server side without requests to client.

network transferByValue: (Instance of: BlockClosure)

Here you will need to apply strategy on client because blocks will be sent from client to server.

3) You can explicitly pass objects with value strategy:

YourService>>getPersons
"on server side"
^retrievePersons asTransferredByValue

4) If persons collection is instance variable of other transferred by value object then you can specify what value means for this container:

PersonContainer>>prepareValueTransferBy: aSeamlessObjectTransporter

aSeamlessObjectTransporter transferByValue: contents

5) You can ask any proxy to load local copy of remote object:

proxy asLocalObject.
  
Important notice: 
- Seamless has no distributed garbage collection. So if you will transfer by reference temporary objects they will be not collected as garbage. For example server could  compute something and return it by reference. Nobody will kill it.
But if you share only long lived service then it is not problem for you.
- there is no security in the level of Seamless. You should organize secure channel by external tools like VPN.

These features are in todo.

Best regards, 
Denis


2017-07-13 18:21 GMT+02:00 Petr Fischer <[hidden email]>:
Hello, I am testing Seamless project (https://github.com/dionisiydk/Seamless) but I did not understand one thing:

I have (for example) a Person class in my server and client image. Person class implements:

Person>>sseamlessDefaultTransferStrategy
        ^SeamlessTransferStrategy defaultByValue

so all Person instances are serialized from server to client image. Good.

But when I have server method, for example, getPersons, that returns a collection (OrderedCollection) of Person instances, this collection is passed by reference (or not?).
OrderedCollection inherits transfer strategy from Object, which is "by reference".

So in client image, when I iterate this collection, too many (thousands) requests occurs.

How to manage only this specific collection (returned from getPersons) to pass by value from server to client (to be completely serialized and copied to the client image), so when I iterate this collection in client image to avoid additional network requests (proxying)?

Thanks! pf



Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Seamless - send collections by value

Petr Fischer
In reply to this post by Denis Kudriashov
Thanks for all advices/options Denis. I will play with them.

pf


> Hi Petr.
>
> There are few solutions to your problem.
>
> 1) You can specify #value strategy for any collections for your network
> instance:
>
>
> network transferByValue: (Kind of: Collection)
>
> For your example you need to apply this strategy on server side. In that
> case client will continue send collections by reference but it will receive
> collections by value from server.
>
> 2) You can specify value strategy for BlockClosure. It will perform
> #select: (for example) on server side without requests to client.
>
> network transferByValue: (Instance of: BlockClosure)
>
>
> Here you will need to apply strategy on client because blocks will be sent
> from client to server.
>
> 3) You can explicitly pass objects with value strategy:
>
> YourService>>getPersons
>
> "on server side"
>
> ^retrievePersons asTransferredByValue
>
>
> 4) If persons collection is instance variable of other transferred by value
> object then you can specify what value means for this container:
>
> PersonContainer>>prepareValueTransferBy: aSeamlessObjectTransporter
>
> aSeamlessObjectTransporter transferByValue: contents
>
>
> 5) You can ask any proxy to load local copy of remote object:
>
> proxy asLocalObject.
>
>
> Important notice:
> - Seamless has no distributed garbage collection. So if you will transfer
> by reference temporary objects they will be not collected as garbage. For
> example server could  compute something and return it by reference. Nobody
> will kill it.
> But if you share only long lived service then it is not problem for you.
> - there is no security in the level of Seamless. You should organize secure
> channel by external tools like VPN.
>
> These features are in todo.
>
> Best regards,
> Denis
>
>
> 2017-07-13 18:21 GMT+02:00 Petr Fischer <[hidden email]>:
>
> > Hello, I am testing Seamless project (https://github.com/
> > dionisiydk/Seamless) but I did not understand one thing:
> >
> > I have (for example) a Person class in my server and client image. Person
> > class implements:
> >
> > Person>>sseamlessDefaultTransferStrategy
> >         ^SeamlessTransferStrategy defaultByValue
> >
> > so all Person instances are serialized from server to client image. Good.
> >
> > But when I have server method, for example, getPersons, that returns a
> > collection (OrderedCollection) of Person instances, this collection is
> > passed by reference (or not?).
> > OrderedCollection inherits transfer strategy from Object, which is "by
> > reference".
> >
> > So in client image, when I iterate this collection, too many (thousands)
> > requests occurs.
> >
> > How to manage only this specific collection (returned from getPersons) to
> > pass by value from server to client (to be completely serialized and copied
> > to the client image), so when I iterate this collection in client image to
> > avoid additional network requests (proxying)?
> >
> > Thanks! pf
> >
> >

Loading...