Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multithreading support during logic adapter selection #110

Open
DarkmatterVale opened this issue Jan 25, 2016 · 1 comment
Open

Multithreading support during logic adapter selection #110

DarkmatterVale opened this issue Jan 25, 2016 · 1 comment

Comments

@DarkmatterVale
Copy link
Collaborator

To increase the speed of processing, multithreading support is really needed.

In the future, when more logic adapters are added including more advanced ones (such as a developer assistant), https://github.com/gunthercox/ChatterBot/blob/master/chatterbot/adapters/logic/multi_adapter.py#L11 will consume a lot of computing resources. If this is all in one thread, it could cause a slowdown of the program this is very noticeable.

Here is my solution: We enable threading at that stage of the processing. In addition, if that is not enough, individual logic adapters can also implement threading, but that is for another issue

@gunthercox
Copy link
Owner

It might be a good idea to weight the advantages of threading vs multiprocessing for this task. Most computers nowadays are built with multi-core processors.

A multiprocessor implementation of this example would allow multi_adapter.py to run the processes for several adapters in parallel on separate processors. Of course the adapter would still need to wait for each adapter to finish processing, but running them in parallel would still accomplish this faster even if a few adapters were lagging behind the others.

Also, (I have to verify this) but I believe that threading would be restricted to a single core. I do think threading would be quite useful for tasks in some adapters such as where a bit of background processing could provide an advantage. (For instance, an email IO adapter could use a thread to periodically check for new emails, if there were new ones it would add them to a queue for the next time it was called to retrieve data. This would remove the need to wait for a web request to return with the updated information every time the adapter is used.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants