Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OpenCloud Lazy Connection? #72

Closed
Richtermeister opened this issue Oct 21, 2013 · 12 comments
Closed

OpenCloud Lazy Connection? #72

Richtermeister opened this issue Oct 21, 2013 · 12 comments

Comments

@Richtermeister
Copy link

Hi all,

Gaufrette has recently added lazy-loading OpenCloud connections (KnpLabs/Gaufrette@5084853). Is this feature currently supported in this bundle? I can't seem to find this in the documentation.. If not, I may be able to contribute this (assuming I can model it off the lazyloading Rackspace connection that already exists here).

Thanks!

@yobud
Copy link

yobud commented May 13, 2014

Is there some news about this issue ?
It seems that Gaufrette still load OpenCloud connection, whatever the controller needs the connection or not.

It throws Sf2 initialization time from 30ms to 750ms.

Thanks

@Richtermeister
Copy link
Author

@ZeBigDuck This issue has been fixed on the Gaufrette level. See here: https://github.com/KnpLabs/Gaufrette#lazyopencloud

Let me know if this doesn't work for you.

@yobud
Copy link

yobud commented May 13, 2014

Hi Richtermeister, thank you for your answer,

In fact, I'm not that I'm using the opencloud adapter. Here's my configuration :

knp_gaufrette:
    adapters:
        default:
            opencloud:
                object_store_id: opencloud.object_store
                container_name: default
    filesystems:
        default:
            adapter:    default

    stream_wrapper:
        protocol: data


services:
    opencloud.connection:
        class: OpenCloud\OpenStack
        arguments:
          - %openstack_identity_url%
          - {username: %openstack_username%, password: %openstack_password%, tenantName: %openstack_tenant_name%}

    opencloud.object_store:
        class: OpenCloud\ObjectStore\Service
        factory_service: opencloud.connection
        factory_method: objectStoreService
        arguments:
          - 'swift' # Object storage type
          - 'RegionOne' # Object storage region
          - 'publicURL' # url type

I'm using openStack, which is in php-opencloud repository. I don't know if I can replace openStack by openCloud...

@Richtermeister
Copy link
Author

Hey @ZeBigDuck. Are you using this with Rackspace? I can look at this tonight, if you're not in a rush..

@yobud
Copy link

yobud commented May 13, 2014

Oh sorry for latency of my answer,

I'm using it with OVH PCS (https://www.ovh.com/fr/cloud/stockage/). I think it works the same way that rackspace does.

This would be awesome if you could do something with this. I'm not sure to understand these libs enough to do it myself.

Thank you very much for your consideration, take your time anyway!

@rvanlaak
Copy link

rvanlaak commented Jan 6, 2015

Any news on using the lazy connection?

@Richtermeister
Copy link
Author

Not on my end. I've actually resorted to just flagging filesystem services as lazyload in the Symfony container.

@ybert
Copy link

ybert commented Feb 17, 2016

I have the same problem.
Symfony initialialization takes 800ms even if I dont use the filesystem in my controller.

Did you fix it?

@Richtermeister
Copy link
Author

@ybert No, this issue is not fixed, but the workaround is simple. Just flag the filesystem service as lazy.

@ybert
Copy link

ybert commented Feb 17, 2016

I think it's easy but I have no idea where I put this flag?

Can you show me where to put this flag in the config?

Thank you for your time.

@ybert
Copy link

ybert commented Feb 17, 2016

Ok I found the trick.
For me it was here:

services:
    opencloud.connection:
        class: OpenCloud\OpenStack
        arguments:
          - %openstack_identity_url%
          - {username: %openstack_username%, password: %openstack_password%, tenantId: %openstack_tenant_id%}
    opencloud.object_store:
        lazy: true
        class: OpenCloud\ObjectStore\Service
        factory: ["@opencloud.connection", objectStoreService]
        arguments:
          - %openstack_object_storage_type%
          - %openstack_object_storage_region%
          - %openstack_object_storage_url%

Thank you it fixed it perfectly

@akerouanton
Copy link
Contributor

As already noted, the best is to define opencloud objects as lazy-loaded services so they won't initialize any external connection every time the container is used. We'll remove LazyOpenCloud from the next major release and it is already deprecated for current minor version (see here and here). As such it'll not be implemented in the bundle.

For concerns about using OpenCloud adapter with OVH, there's already an issue. But I don't if it works currently.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants