Options

problems getting large numbers of sub categories and images from smugmug using smugPH

LintLint Registered Users Posts: 27 Big grins
first off, I'm not sure if this is a Smugmug problem, a phpsmug problem or my problem, but I'm kind of stuck so I'll post anyway and see what pops its head over the parapet.

It started off when I was pulling information about my entire Smugmug data set out for a Wordpress plugin. I was doing it in a pretty brain dead kind of way, grabbing the categories then for each category, grabbing the sub categories then for each sub category grabbing its albums .... etc. The first once or twice that I ran the page it was fine and then I started to get blank pages, which I took to be PHP timeouts at my provider's end - they set PHP timeout to 10 seconds. After a bit I found that if I limited the count of sub-categories from 60 and odd to around 20, the problem didn't entirely go away but it behaved a whole lot better. So it seems the problem might have something to do with loads of calls into the API.

I'm grabbing a new phpSmug object and handing it a token at the start of the page. I'm not storing anything in the session - other than the oauth token, obviously - and I wonder if this might be the wrong thing to do.

Any help appreciated.

Oauth newbie, by the way.

Comments

  • Options
    SamirDSamirD Registered Users Posts: 3,474 Major grins
    edited November 25, 2010
    Wow. Still running into this problem? headscratch.gif
    Pictures and Videos of the Huntsville Car Scene: www.huntsvillecarscene.com
    Want faster uploading? Vote for FTP!
  • Options
    devbobodevbobo Registered Users, Retired Mod Posts: 4,339 SmugMug Employee
    edited November 25, 2010
    Lint,

    Is there any chance you could email me your code to take a look at ? david at smugmug

    Cheers,

    David
    David Parry
    SmugMug API Developer
    My Photos
  • Options
    SamirDSamirD Registered Users Posts: 3,474 Major grins
    edited November 28, 2010
    Lint, I think I may have found a solution to this that dawned on me this morning.

    The API server can handle thousands of requests a second, but it chokes when the same session tries several requests per second. The solution may be to have a different session ID for each piece of information.

    Now, I know this sounds kinda crazy, but you'd basically login each time and get a new session ID with each request. This way, the server won't reject it. (I'm assuming that it won't look at this as some sort of attack and lock you out.)

    Thoughts? headscratch.gif
    Pictures and Videos of the Huntsville Car Scene: www.huntsvillecarscene.com
    Want faster uploading? Vote for FTP!
  • Options
    devbobodevbobo Registered Users, Retired Mod Posts: 4,339 SmugMug Employee
    edited November 28, 2010
    SamirD wrote: »
    Lint, I think I may have found a solution to this that dawned on me this morning.

    The API server can handle thousands of requests a second, but it chokes when the same session tries several requests per second. The solution may be to have a different session ID for each piece of information.

    Now, I know this sounds kinda crazy, but you'd basically login each time and get a new session ID with each request. This way, the server won't reject it. (I'm assuming that it won't look at this as some sort of attack and lock you out.)

    Thoughts? headscratch.gif

    He's using OAuth so he doesn't need to do this.
    David Parry
    SmugMug API Developer
    My Photos
  • Options
    SamirDSamirD Registered Users Posts: 3,474 Major grins
    edited November 28, 2010
    So is the problem he's experiencing not by design? headscratch.gif I'll be working on a script that will help me collect images from one album to another using the api. I'm concerned about his issue because I'll be doing something similar as each image being collected will be its own call. In a gallery with hundreds of images, that's hundreds of calls in the span of a few seconds.
    Pictures and Videos of the Huntsville Car Scene: www.huntsvillecarscene.com
    Want faster uploading? Vote for FTP!
Sign In or Register to comment.