Menu

BUFFER SIZE

Help
2001-11-20
2003-12-04
  • Nobody/Anonymous

    how to modify the buffer size of a request sql?

     
    • Frédéric RUAUDEL

      to change the max size of the request string, you must change the define :

      #define MAX_REQ_SIZE   2048

      in file src/include/sqlb_common.h

      - GrumZ -

       
    • Nobody/Anonymous

      Hi,
        I tried to increase the MAX_REQ_SIZE to 4096, recompiled and started sqlb. But no connection was possible. I get this error:

      [Error] : Sqlb error : [Error] : wait4client : Time out !.
      [Error] : Can't get result : timeout.
      - No such file or directory.

      I thought that I made a mistake somewhere else, so I changed back to 2048, recompiled, restarted and it works again. I tried many times, with the same result.

      What is the highest possible value I can set MAX_REQ_SIZE to so I do not get the timeout ?

       
    • Frédéric RUAUDEL

      I check for the problem right now, but do you really need to send a request -- I mean something like "select * from ..." or something like that and not the result -- that is more than 2048 characters long ??

      I don't know what you try to do but I can advise you that sqlb is much more efficient with many little request than with big ones, because the big ones tend to block the queues. You should have a look at the traker named  "tips & tricks" if you have not already read it, it's full of good advices to optimize the use of sqlb and get the best of it :)

      If you can't do otherwise, so I will try to do my best to solve this problem for you, of course :)

      Thanks for trying sqlb, I hope it will satisfy you

      - GrumZ -

       
    • Nobody/Anonymous

      Hi GrumZ ;)
        Thank you for your reply. I need to increase this buffer bacause of only few queries that are simply too long (it is an insert to a wide table). 99.9999% of queries of course fit into the 2048 limit ;)

      Anyway I am very satisfied with SQLB. Keep up the good work ! ;))

      Btw: can you briefly explain why this Wait4Client happens ? I get this sometimes (not very offten) even with 2048 limit. Then must restart the sqlb (sometimes even clear the shared memory)...

      Thanks a lot ;)

      Marek

       
    • Frédéric RUAUDEL

      When you modify MAX_REQ_SIZE, do you try a small request like "select foo from bar limit 1" or your huge one that could take a very long time to execute. ?

      Because the timeout has been implemented to avoid blocking the client if the database doesn't respond. You receive a error code that inform you that the request timed out in order you can choose what to do then :

      1) retry maybe with a higher timeout value
      2) abort the request and report a problem to the application
      3) any other thing.

      Presently, the problem with this is that I can't insure you that the request you send has been executed or not. For non critical application, it's not a problem but for critical one it could be, of course. For the moment, I didn't find a solution to solve this problem.

      To understand what is going on, I make a diagram to explain sqlb mechanism in the "What is it ?" section of the web site.
      The repartition system works in a manner that every request is served in the order they ask for the job. To do this, the client, after submiting his job, open a socket and wait the result from the server. If the server never responds for whatever reason, without a timeout on the socket, the client would stay stuck indefinitely and you will just have to kill it to solve the problem.

      The API allows you to set a different timeout for each request. So try to increase the default value and tell me if your client still times out.

      for the C API, it's the last arguments :

      int Sqlbexec2 (const char *query,
                           t_tab *tab,
                           const char *base_name,
                           const char *base_type,
                           int timeout);

      For the PHP API, if you use the wrappers I suggest in the doc, you must add the argument or change the default value in the functions defined in them, and if you use the native API, this is the last arguments too :

      $result = accelsqlb ($query,
                                   $sqlb_base_name, 
                                   $sqlb_base_type,
                                   $state,
                                   $timeout);

      And for the perl API, it the same :

      $sqlb = SQLB::exec_query ($query,
                                              $dbname,
                                              $dbtype [,
                                              $timeout = 120 ] );

      The default is 120 sec.

      Please, try this and tell me if it solve your problem or not.

      Thanks,

      - GrumZ -

       
    • Nobody/Anonymous

      Hi,
      In fact I can't test the API because it looks like it has problems with esteblishing connection with the server. This is what i get:
                                                                                                                                                                      
      (Compiled with MAX_REQ_SIZE=4096)
                                                                                                                                                                      
      [root@dev sqlb-2.4.8]# sqlbplus2 -t oracle -n my_db
      [Error] : Sqlb error : [Error] : wait4client : Time out !.
      [Error] : Can't get result : timeout.
      - No such file or directory.
      [root@dev sqlb-2.4.8]#
                                                                                                                                                                      
      So I can't try out any query. If needed I can send you some log extracts.
                                                                                                                                                                      
      Marek

       
    • Frédéric RUAUDEL

      Try to send a valid request with the sqlbclient tool :
                                                                                                                                                                      
      user$ sqlbclient -t oracle -n my_db -q "select ..." -s 300
                                                                                                                                                                      
      the 300 value is the timeout (default is 120 as I said earlier ;)
                                                                                                                                                                      
      eventually send it with the command time to check that the timeout is correctly respected.
                                                                                                                                                                      
      user$ time sqlbclient ...
                                                                                                                                                                      
      - GrumZ -

       
      • Nobody/Anonymous

        [root@localhost sqlb]# sqlbclient -t oracle -n my_db -q "select * from my_tables" -s 300
                                                                                                                                                                        
        waiting 5 mins and getting again:
                                                                                                                                                                        
        [Error] : wait4client : Time out !.
        [Error] : Can't get result : timeout.
                                                                                                                                                                        
        [root@localhost sqlb]#

         

Log in to post a comment.

Auth0 Logo