How to drive thousands of files with Evictor ?

kingbokingbo Member Tang FanOrganization: ShenZhen Yijin Platform Network Technology Co.,LtdProject: Stock quotation server
To test the ablility of evictor to support thousands of files, I change the demo code in ICE_HOME/demo/Freeze/phonebook/Server.cpp as following:
...
...
Freeze::EvictorPtr evictor = Freeze::createEvictor(adapter,_envName, "contacts", 0, indices);
adapter->addServantLocator(evictor, "contact");
for(int i=0;i<1000;++i)
{
char buff[100];
sprintf(buff,"file%d",i);
Freeze::EvictorPtr temEvictor = Freeze::createEvictor(adapter, _envName, string(buff));
adapter->addServantLocator(temEvictor, string(buff));
}
...
...
I set the DB_CONFIG file and copy it in ICE_HOME/demo/Freeze/phonebook/db
set_lk_max_lockers 40000
set_lk_max_locks 40000
set_lk_max_objects 40000
set_lg_regionmax 2400000
set_cachesize 0 104857600 1

When I run the demo with Ice-3.0.1-VC60, the demo can only drive 493 files and abort with "Lock table is out of available locks " message. What cause this problem?

Thanks

Comments

  • kingbokingbo Member Tang FanOrganization: ShenZhen Yijin Platform Network Technology Co.,LtdProject: Stock quotation server
    make the Signature done
  • bernardbernard Jupiter, FLAdministrators, ZeroC Staff Bernard NormierOrganization: ZeroC, Inc.Project: Ice ZeroC Staff
    Why would you want to create hundreds or thousands of Evictors?

    It's like creating hundreds or thousands of tables in a relational database; why would you do it? Do you have hundreds of different types? This sounds quite unlikely.

    In any case, you can create more Evictors by tweaking the Berkeley DB configuration file. See this thread for details.

    Best regards,
    Bernard
  • kingbokingbo Member Tang FanOrganization: ShenZhen Yijin Platform Network Technology Co.,LtdProject: Stock quotation server
    My DB_CONFIG as following:
    set_lk_max_lockers 40000
    set_lk_max_locks 40000
    set_lk_max_objects 40000
    set_lg_regionmax 2400000
    set_cachesize 0 104857600 1
    I copyed the DB_CONFIG file to ICE_HOME/demo/Freeze/phonebook/db,but can not slove the problem.

    The reason that I want to create thousands of files with Evictors is:
    1. I can't use a relational database,such as SQL SERVER, because my client need be support by database too and I want to use the same code both in server and client.
    2. My current slice look like:
    class IKLine
    {
    long time;
    long high;
    long open;
    long close;
    long low;
    long vol;

    some access functions
    };
    I plan to index the table with time field and name every file with stock name. Since there are thousands of stocks , I need to create thousands of files with Evictors.
    If I want to drive all stocks with one file, I have to change the slice like:
    class IKLine
    {
    string stockName;
    long time;
    long high;
    long open;
    long close;
    long low;
    long vol;

    some access functions
    };
    However Berkeley DB does not support sql language. In this case, I will lose some flexibilities.
  • bernardbernard Jupiter, FLAdministrators, ZeroC Staff Bernard NormierOrganization: ZeroC, Inc.Project: Ice ZeroC Staff
    I strongly recommend to use a single class / Evictor for all your stocks.

    Which flexibilility do you loose with a single Evictor?

    Cheers,
    Bernard
  • kingbokingbo Member Tang FanOrganization: ShenZhen Yijin Platform Network Technology Co.,LtdProject: Stock quotation server
    yeah,you remind me another way! Thanks a lot!All the reason that I choose the current awkward design is I did not understand the the use of indices clearly when I learned ICE a year ago.
    I plan to change my slice like this:
    struct ITitle
    {
    string stockName;
    long time;
    };

    class IKline
    {
    ITitle title;
    long high;
    long open;
    long close;
    long low;
    long vol;

    };
    And index the table with title field.In this design, I am still puzzled by the following questions about the use of ndices :
    1.How to index title with descending order ? since there is findFirst(member-type index, int firstN) function in ICE but no findlast function.
    2. For given stockName, how to find all the records whose x<title.time&&title.time<y ?
  • bernardbernard Jupiter, FLAdministrators, ZeroC Staff Bernard NormierOrganization: ZeroC, Inc.Project: Ice ZeroC Staff
    kingbo wrote:
    1.How to index title with descending order ? since there is findFirst(member-type index, int firstN) function in ICE but no findlast function.
    2. For given stockName, how to find all the records whose x<title.time&&title.time<y ?

    The Freeze Evictor does not offer any form of sorting. firstFirst() simply returns the identities of up to n objects whose member matches exactly the given parameter.

    Freeze Maps offer more powerful indexing features, including sorting; if you switch to a Freeze Map, you could create a sorted index on your title to perform range-queries.

    Cheers,
    Bernard
  • kingbokingbo Member Tang FanOrganization: ShenZhen Yijin Platform Network Technology Co.,LtdProject: Stock quotation server
    Thanks for your suggestion.
    I will review the chapter of Freeze Map and try it.
  • matthewmatthew NL, CanadaMember Matthew NewhookOrganization: ZeroC, Inc.Project: Internet Communications Engine ✭✭✭
    Note that there are also newsletter articles on this topic.
Sign In or Register to comment.