Rest Api - Bad Performance (Slow Problem)

Showing results for 
Search instead for 
Did you mean: 
Active Member II

Rest Api - Bad Performance (Slow Problem)

Hi all,

I m using Alfresco Community 5.2. And I added some sites, folders and people by using REST API. But Alfresco Rest Api is running so slowly. For example When I updated just about 1000 site with rest api, This process takes about 40 minutes.

How can I do this issue or How can i speed this up ? Please help..

Thanks in advance.

2 Replies

Re: Rest Api - Bad Performance (Slow Problem)

Much more detail is needed before we can begin to help. For example:

  • What is the architecture of your server (where is the database running, where is SOLR running, some idea of hardware and OS).
  • What API calls are you making?
  • How are you making those calls (share the code)?
  • What other traffic is hitting the server while you are doing this?
  • What is happening on the server in terms of CPU and RAM when you are running your updates?
  • What is happening on the database, especially database connections, when you are running your updates?
  • Are you invoking your updates over a network? Could there be bandwidth or latency issues? Are you saturating the network interface with requests?
Active Member II

Re: Rest Api - Bad Performance (Slow Problem)

  • I m using solr and mysql database .
  • I call some API like create site, add membership to sites, inherit permission, calculate node reference, create person, upload documents, etc...I m giving just an example my api methot (addMemebersToSites api method)(this method and other is running for 1000 site for every day)
  • In code, "client.executeMethod(post)" line is running so slowly. So I received response too late.

    private static void addMemebersToSites(String usid,String siteID,String role)
    HttpClient client = new HttpClient();

    String apiurl = api+"alfresco/service/api/sites/"+siteID+"/memberships";
    PostMethod post = null;
    try {

    post = new PostMethod(URIUtil.encodePath(apiurl));
    JsonObject person = new JsonObject();
    person.addProperty("userName", usid);

    JsonObject member = new JsonObject();
    member.addProperty("role", role);
    member.add("person", person);
    post.setRequestHeader("Content-Type", "application/json; charset=utf-8");
    post.setRequestHeader(HttpHeaders.AUTHORIZATION, pass);
    post.setRequestEntity(new StringRequestEntity(member.toString(), "application/json; charset=utf-8", "UTF-8"));

    int status = client.executeMethod(post);

    if(status == 200 || status==201)
    System.out.println(status + " " +usid + " is added to this web site");
    System.out.println(status + " " + usid + " can not added to this web site(error)");

    } catch (Exception e) {
    } finally {