php - Running a long code using facebook API -
i'm trying make app goes , actions friends user of app has. problem didn't find yet platform can develop such app on. @ first tried using php, used heroku , code worked because had many friends loop went more 30 seconds , request timed out , operation stopped in middle of action. don't mind using platform want work! python, c++, php. fine me. in advance.
let's start can change timeout settings, depending on restriction set, can on php explained set_time_limit function documentation:
set number of seconds script allowed run. if reached, script returns fatal error. default limit 30 seconds or, if exists, max_execution_time value defined in php.ini.
but can set on server itself.
issue routers on route have own timeout limit, experience ~60 seconds max.
as want do, problem not language/technology use, fact you're making lot of http requests facebook take bit of time, , believe bottleneck, , if that's case there's not can improve choosing other php (though can go nio should improve io performance).
with said, php not best solution, depends on task @ hand.
java or other compiled language should perform better scripted language (php, python), , if go c++ top 'em all, feel comfortable program app in c++?
choose language/technology feel "at home" with, if have selection choose figure out need app , research on perform better need.
edit
last time checked maximum number of friends limited 5000.
if need to run graph request per user friend there's no way can without keeping user waiting way long, regardless of timeouts.
you have 2 options see it:
make client asynchronous, can use web sockets, comet, or issue ajax request every x seconds computed data.
way don't need worry timeouts , user can start getting content quickly.use javascript api make graph requests, way avoid timing out, plus reduce huge amount of networking servers.
option might not available if need servers computation, if example depend on data db.
as "no facebook sdk c++" issue, though don't think it's relevant, it's not problem.
facebook sdks wrappers https request, implementing own sdk not hard, though hate thinking doing c++, again hate thinking doing c++.
Comments
Post a Comment