aMule Forum

English => Feature requests => Topic started by: Buzard on September 23, 2006, 12:38:05 PM

Title: Max number of upload slots (again)
Post by: Buzard on September 23, 2006, 12:38:05 PM
hello next to this closed topic (http://www.amule.org/amule/thread.php?threadid=10683&sid=)

I have some question, In deed i actually using aMule on linux system, and i couldn't find nowhere the options in question in the topic (limit per slots, etc ...)  So I will be pleased if someone can tell me where those options are.

My problem is that aMule opens to many upload slots (something like 20) and it make lag my computer.

I have till now to options, the first is to decrease upload bandwidth to something like 10ko/s, so it opens only 4 or 5 slots. But it isn't really satisfying. so much bandwiith unused !

So I decided to make little modification in source code, so have a basic slot control. I found two places where clients are put to upload list. So I add there some basic test like (if number of slots < max number of slot). It seems to work fine, but sometime this number of slots get through this limits. And the matter is that when it does, it consumes all the upload queue!

I search for problem in exclusive portion of code, but in fact i didn't really understand the way aMule uses mutex. It is like it ask for mutex exclusion but never release them!

so please someone can help me, and say me what can i do, to have this working better.

here the two functions where i made modification :

/** file : UploadBandwidthThrottle.cpp
 * function : UploadBandwidthThrottler::AddToStandardList
 **/
void UploadBandwidthThrottler::AddToStandardList(uint32 index, ThrottledFileSocket* socket)
{
    if ( socket )
    {
         wxMutexLocker lock( m_sendLocker );

         if (m_StandardOrder_list.size() < 4) // HERE THE TEST I ADD
         {
             RemoveFromStandardListNoLock(socket);
             if (index > (uint32)m_StandardOrder_list.size())
             {
                 index = m_StandardOrder_list.size();
             }

             m_StandardOrder_list.insert(
                   m_StandardOrder_list.begin()
                 + index
                 , socket
             );
         }
    }
}

/** file : Upload
 * function : CUploadQueue::Process
 **/
void CUploadQueue::Process()
{
    // POINT 1
    if (AcceptNewClient() && waitinglist.GetCount()
    && uploadinglist.GetSize() < 4 ) // HERE THE OTHER TEST I ADD
    {
        m_nLastStartUpload = ::GetTickCount();
        AddUpNextClient();
    }
    // POINT 2

... and so on


I suspect the problem is due to the lake of mutex exclusion between Point 1 and Point 2.  But i don't know if it's good to put exclusion at this level? If someone has an idea ...

Bah i'll try it and see what happen ...

to be continued
Title: Re: Max number of upload slots (again)
Post by: Buzard on September 23, 2006, 01:09:07 PM
It works fine!

i added a mutex exclusion just at the point 1 (in fact after the test :


void CUploadQueue::Process()
{
        if (AcceptNewClient() && waitinglist.GetCount())
        {
                wxMutexLocker lock(poorLonesomeMutex); // THE MUTEX IS HERE
                if (uploadinglist.GetSize() < 4 ) // THE TEST HERE
                {
                        m_nLastStartUpload = ::GetTickCount();
                        AddUpNextClient();
                }
        }

 ... and so on


I have just some artefact when the upload list refreshes. But it don't bother me cause more the time aMule in minimized.

So it's good :  a handy slot control in five lines,  :D

bye
Title: Re: Max number of upload slots (again)
Post by: ken on September 24, 2006, 05:17:50 PM
Um, this already exists in the code.  There should be no need to change anything.

maximum upload slots used = bandwidth limit / slot allocation

I think the only exception is that aMule ignores your slot allocation if it would result in fewer than 3 slots.

Search the wiki for "slot allocation" for more details.
Title: Re: Max number of upload slots (again)
Post by: Kry on September 24, 2006, 06:33:57 PM
Or if the slot allocation pero peer can't be reached, then it opens other slot to compensate the unused bandwith.

Thre's no need for any new code.
Title: Re: Max number of upload slots (again)
Post by: Buzard on September 29, 2006, 01:33:47 PM
In fact i don't mind if there is no need, cause i already did it for me. and it's all i wanted.

the fact is that i found nowhere in the configuration menu the slot allocation. What does this option look like, where it is?

if you have a screenshot i would be pleased.

Quote
Or if the slot allocation per peer can't be reached, then it opens other slot to compensate the unused bandwith.

But this is a wrong way i think. There is many raison possible for not reaching the maximum upload speed. And one of it is the non disponibility of the entire network, so why add more request again and again in this case, and so overload the network.
An other, is the structure of the connection, when connected with asymetric connection, upload and download can't be at max at the same time, and so if the peer is download very fast, it is normal he can't upload the same way.

A better solution would have been to choose one slot that is not healthy (less than 1Ko/s) and throw it (if it is slow it means that the peer is too far, and surely someone else with better ping w/ to this peer, could give him better throughbput)
And replace it with one that pings well.

I know this method is restrictive in the sense that people with slow connected, will be ejected from many peers upload slot. And so there downloading time wil increase. But i am sure a system of credit exchange, could solve this problem.
Title: Re: Max number of upload slots (again)
Post by: wuischke on September 29, 2006, 01:58:07 PM
(http://img168.imageshack.us/img168/149/slotallocationan2.th.jpg) (http://img168.imageshack.us/my.php?image=slotallocationan2.jpg)

Even though I don't have a stable speed of 8KB/s for all slots I've always 5 slots and a good overall upload speed. And that's what I want. ;)
Title: Re: Max number of upload slots (again)
Post by: Lord_neo on April 26, 2011, 10:44:24 AM
Hi to everyone,

i found this topic and i guess it is the right place to ask my question.

You have talked about upload slot management, and in these days on my aMule 2.2.6 i was controlling its behaviour.

You said that aMule makes a check on unused bandwith?

My aMule is now set with 40 kB/s as limit, and with 8 KB/s as slot. This means 5 upload slot. Unfortunately I reach only 18/20 KB/s for reasons that do not depend on my configuration, because if I decrease slot dimension i can easily reach 40 KB/s.

Is this the right behaviour of aMule upload? I am not using a lot of upload bandwidth!!

Thanks in advance
Title: Re: Max number of upload slots (again)
Post by: Stu Redman on April 26, 2011, 05:45:59 PM
Please try 2.3.1 rc, upload slot handling was changed there somehow.
Title: Re: Max number of upload slots (again)
Post by: Lord_neo on April 27, 2011, 01:15:01 AM
Please try 2.3.1 rc, upload slot handling was changed there somehow.

Oh thanks for the hint.. But I'm on Ubuntu 10.04 LTS and to get fewer wx incompatibilities i would prefere to upgrade my os... :-\
Title: Re: Max number of upload slots (again)
Post by: Lord_neo on May 10, 2011, 06:36:51 PM
A more deep analysis made me conclude that i'm filtered from my isp, so it is not only an aMule issue.  >:(
Title: Re: Max number of upload slots (again)
Post by: Stu Redman on May 10, 2011, 07:42:13 PM
Did you at least change the default ports?
Title: Re: Max number of upload slots (again)
Post by: myth on May 10, 2011, 09:03:48 PM
Teletu filters by content...also PO (protocol obfuscation) is detected AFAIK.
Title: Re: Max number of upload slots (again)
Post by: Lord_neo on May 10, 2011, 11:29:37 PM
Did you at least change the default ports?

Yes, sure. I get High ID but only 10-12 KB/s of upload bandwith, when i could have 40 KB/s. The filtering, even with obsuscation protocol actived, occurs during the day from 11-12 a.m. until 11:59 p.m.

Teletu filters by content...also PO (protocol obfuscation) is detected AFAIK.
It's my ISP too.  >:(