Asterisk-java, 3 conf files,9000 stations & 6 hours!

I am using java program.
In my programs function (which use for add stations to asterisk) ‘for loop’ use & each time from
asterisk-java-1.0.0.M3.jar calls UpdateConfigAction.java.
In this addCommand function calls. It puts all info in ‘action’ which use in ManagerAction.java which further use in ManagerConnection.java’s sendAction function. By this activity 3 conf files edit & parse & save
sip.conf
queues.conf
extensions.conf

When i select 100 stations then 26-30sec for whole process utilize.
When i select 1000 stations then 7-8min for whole process utilize.
When i select 10000 stations then 6.93hours for whole process utilize.

I observe that in sip conf if i add only one station which number 100 then following few lines add by my java program.

[00100]
username = 00100
secret = 00100
type = friend
insecure = port,invite
host = dynamic
context = users

in extensions.conf following lines add

exten => 00100,1,wait(0.05)
exten => 00100,2,Queue(00100)
exten => 01100,1,Dial(SIP/01100)
exten => 02100,1,Dial(SIP/02100)

in queues.conf following lines add

[00100]

When i choose 9000 stations to add first time then in these 3 conf files get added multiple times particular lines repeatedly with particular number. ie in extensions.conf we can see 4 lines for 9000 stations ie 36000 lines.
Sip.conf & queues.conf & extensions.conf all have default settings which give in any basic tutorial.
Only 1 line change ie

extenpatternmatchnew=yes in extensions.conf
I observe file size also.

When 0 stations added in 3 conf files then their sizes as below(Note each time i clear entries & make asterisk as first time running)
sip.conf = 46.6kb
extensions.conf = 28.5kb
queues.conf = 81.3kb

But

when 1000 stations then time 7.69min
sip conf = 371.9kb
extensions.conf = 161.3kb
queues.conf = 11.0kb

when 2000 stations then time 24.07 minutes
sip.conf = 697.0kb
extensions.conf = 289.3 kb
queues.conf = 19.7kb

from 3000 to 8000 still i am checking time & size but

When 9000 stations add first time, then
sip.conf 2.9MB
extensions.conf 1.2 MB
queues.conf 81.3kb

Then now how can i reduce this time when i select more than 9000 stations?
Any further details needs to understand what is my problem then i am ready to give more details.
Please i hope somebody help me!
Thanks.

Hi, you are repeating this issue in many threads, you should open one thread and attach to it, open many threads doesn’t guarantee that you will receive a response.

In the other hand, you have a very specific issue, IMO I don’t think the size of the file matters you should look at the program in how it handle the file, how is buffered, opened and how it write & save it. If you think that is related to an issue with text files you can switch and try with ARA using a database to write your config.

There are plenty tutorials in the web explaining how to use MySQL to store the configs you only need to look carefully.

Just tested a simple bash FOR to add 9000 peers it took 3 seconds the file size its ~900Kb. I used this line to add it:

So you may check how your JAVA program is handling the PC resources and handling the text files.