You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ariatosca.apache.org by D Jayachandran <d....@ericsson.com> on 2018/01/03 05:50:04 UTC

RE: Database session management with model storage.

Hi All,

Currently ARIA functions as a single threaded application particularly with the session management. The sql_mapi does not get the session and engine on a thread local basis.
We feel it is necessary to make changes in session management to effectively support multithreading  scenarios. 
If all agree we can contribute on this.

Regards,
DJ 
-----Original Message-----
From: D Jayachandran 
Sent: Friday, December 29, 2017 12:01 PM
To: dev@ariatosca.incubator.apache.org; Maxim Orlov <ma...@cloudify.co>
Subject: RE: Database session management with model storage.

Hi Tal,

More than the database used, I was referring on how the model storage is being initialized and exposed.
The sqlalchemy has by its own a sessionfactory and a scopesession to have sessions being exposed as thread local. 
But With ARIA I feel this is not properly utilized as it is initialized the ModelStorage only once. 

Please find the below code snippet from env.py where the model storage is initialized.
    @property
    def model_storage(self):
        if not self._model_storage:
            self._model_storage = self._init_sqlite_model_storage()
        return self._model_storage


Regards,
DJ
-----Original Message-----
From: Tal Liron [mailto:tal@cloudify.co]
Sent: Friday, December 29, 2017 11:41 AM
To: dev@ariatosca.incubator.apache.org; Maxim Orlov <ma...@cloudify.co>
Subject: Re: Database session management with model storage.

The default storage, SQLite, has certain concurrency limitations, but if you use a more robust server (MySQL, Postresql) there should be no issues.

Maxim, any thoughts?

On Fri, Dec 29, 2017 at 12:01 AM, D Jayachandran < d.jayachandran@ericsson.com> wrote:

> Hi,
>
> We have built a REST Interface on top of ARIA. With the current 
> implementation of ARIA, the "model storage" is seen as a singleton 
> class, thereby the database session is also restricted to a single session.
> By exposing ARIA over REST, In a multithreaded scenario we are ending 
> up in having the same database session over multiple threads. This 
> will bring about issues during various db related actions across multiple requests.
>
> ARIA being a CLI at this moment will not have any issues with this 
> approach but to be used and exposed over other interfaces it will be a 
> challenge.
> Please let us know if the session management can be handled properly 
> with the model storage ? Do you already have any plans to work on this 
> item or kindly provide your feedback on this issue.
>
>
> Regards,
> DJ
>

RE: Database session management with model storage.

Posted by D Jayachandran <d....@ericsson.com>.
Thanks Maxim, I will check and contribute accordingly.

Regards,
DJ

From: Maxim Orlov [mailto:maxim@cloudify.co]
Sent: Thursday, January 04, 2018 3:08 PM
To: D Jayachandran <d....@ericsson.com>
Cc: dev@ariatosca.incubator.apache.org
Subject: Re: Database session management with model storage.

Well, the question is can we achieve the same functionality via the initiator to the model storage. Although it is initiated only once, using the sessionfactory with the initiator might help.
If not, it could be a great contribution to the project.

On Wed, Jan 3, 2018 at 7:50 AM D Jayachandran <d....@ericsson.com>> wrote:
Hi All,

Currently ARIA functions as a single threaded application particularly with the session management. The sql_mapi does not get the session and engine on a thread local basis.
We feel it is necessary to make changes in session management to effectively support multithreading  scenarios.
If all agree we can contribute on this.

Regards,
DJ
-----Original Message-----
From: D Jayachandran
Sent: Friday, December 29, 2017 12:01 PM
To: dev@ariatosca.incubator.apache.org<ma...@ariatosca.incubator.apache.org>; Maxim Orlov <ma...@cloudify.co>>
Subject: RE: Database session management with model storage.

Hi Tal,

More than the database used, I was referring on how the model storage is being initialized and exposed.
The sqlalchemy has by its own a sessionfactory and a scopesession to have sessions being exposed as thread local.
But With ARIA I feel this is not properly utilized as it is initialized the ModelStorage only once.

Please find the below code snippet from env.py where the model storage is initialized.
    @property
    def model_storage(self):
        if not self._model_storage:
            self._model_storage = self._init_sqlite_model_storage()
        return self._model_storage


Regards,
DJ
-----Original Message-----
From: Tal Liron [mailto:tal@cloudify.co<ma...@cloudify.co>]
Sent: Friday, December 29, 2017 11:41 AM
To: dev@ariatosca.incubator.apache.org<ma...@ariatosca.incubator.apache.org>; Maxim Orlov <ma...@cloudify.co>>
Subject: Re: Database session management with model storage.

The default storage, SQLite, has certain concurrency limitations, but if you use a more robust server (MySQL, Postresql) there should be no issues.

Maxim, any thoughts?

On Fri, Dec 29, 2017 at 12:01 AM, D Jayachandran < d.jayachandran@ericsson.com<ma...@ericsson.com>> wrote:

> Hi,
>
> We have built a REST Interface on top of ARIA. With the current
> implementation of ARIA, the "model storage" is seen as a singleton
> class, thereby the database session is also restricted to a single session.
> By exposing ARIA over REST, In a multithreaded scenario we are ending
> up in having the same database session over multiple threads. This
> will bring about issues during various db related actions across multiple requests.
>
> ARIA being a CLI at this moment will not have any issues with this
> approach but to be used and exposed over other interfaces it will be a
> challenge.
> Please let us know if the session management can be handled properly
> with the model storage ? Do you already have any plans to work on this
> item or kindly provide your feedback on this issue.
>
>
> Regards,
> DJ
>

Re: Database session management with model storage.

Posted by Maxim Orlov <ma...@cloudify.co>.
Well, the question is can we achieve the same functionality via the
initiator to the model storage. Although it is initiated only once, using
the sessionfactory with the initiator might help.
If not, it could be a great contribution to the project.

On Wed, Jan 3, 2018 at 7:50 AM D Jayachandran <d....@ericsson.com>
wrote:

> Hi All,
>
> Currently ARIA functions as a single threaded application particularly
> with the session management. The sql_mapi does not get the session and
> engine on a thread local basis.
> We feel it is necessary to make changes in session management to
> effectively support multithreading  scenarios.
> If all agree we can contribute on this.
>
> Regards,
> DJ
> -----Original Message-----
> From: D Jayachandran
> Sent: Friday, December 29, 2017 12:01 PM
> To: dev@ariatosca.incubator.apache.org; Maxim Orlov <ma...@cloudify.co>
> Subject: RE: Database session management with model storage.
>
> Hi Tal,
>
> More than the database used, I was referring on how the model storage is
> being initialized and exposed.
> The sqlalchemy has by its own a sessionfactory and a scopesession to have
> sessions being exposed as thread local.
> But With ARIA I feel this is not properly utilized as it is initialized
> the ModelStorage only once.
>
> Please find the below code snippet from env.py where the model storage is
> initialized.
>     @property
>     def model_storage(self):
>         if not self._model_storage:
>             self._model_storage = self._init_sqlite_model_storage()
>         return self._model_storage
>
>
> Regards,
> DJ
> -----Original Message-----
> From: Tal Liron [mailto:tal@cloudify.co]
> Sent: Friday, December 29, 2017 11:41 AM
> To: dev@ariatosca.incubator.apache.org; Maxim Orlov <ma...@cloudify.co>
> Subject: Re: Database session management with model storage.
>
> The default storage, SQLite, has certain concurrency limitations, but if
> you use a more robust server (MySQL, Postresql) there should be no issues.
>
> Maxim, any thoughts?
>
> On Fri, Dec 29, 2017 at 12:01 AM, D Jayachandran <
> d.jayachandran@ericsson.com> wrote:
>
> > Hi,
> >
> > We have built a REST Interface on top of ARIA. With the current
> > implementation of ARIA, the "model storage" is seen as a singleton
> > class, thereby the database session is also restricted to a single
> session.
> > By exposing ARIA over REST, In a multithreaded scenario we are ending
> > up in having the same database session over multiple threads. This
> > will bring about issues during various db related actions across
> multiple requests.
> >
> > ARIA being a CLI at this moment will not have any issues with this
> > approach but to be used and exposed over other interfaces it will be a
> > challenge.
> > Please let us know if the session management can be handled properly
> > with the model storage ? Do you already have any plans to work on this
> > item or kindly provide your feedback on this issue.
> >
> >
> > Regards,
> > DJ
> >
>