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

Solve our processes eating 100% of the CPU when idle #16

Closed
eldraco opened this issue Feb 5, 2019 · 4 comments
Closed

Solve our processes eating 100% of the CPU when idle #16

eldraco opened this issue Feb 5, 2019 · 4 comments
Labels
Advanced Advanced python required help wanted

Comments

@eldraco
Copy link
Collaborator

eldraco commented Feb 5, 2019

Our processes do not block on the queues yet, so when there is no data to receive they eat the CPU.
But we need them to processes the input data as fast as possible.

@eldraco eldraco added help wanted Advanced Advanced python required labels Feb 5, 2019
@arkamar
Copy link
Contributor

arkamar commented Feb 7, 2019

I solved the busy waiting issue in https://github.com/arkamar/StratosphereLinuxIPS/tree/i16 branch. Main problem was that we used the busy waiting

while True:
	self.queue.empty():
		pass
	else:
		data = self.queue.get()
		do_job(data)

where self.queue.empty() is non-blocking method, but we should use blocking methods put and get.

while True:
	data = self.queue.get()
	do_job(data)

Should I do a pull request?

@eldraco
Copy link
Collaborator Author

eldraco commented Feb 7, 2019

Thanks a lot! I'm trying and telling back. You can do a pull request or not. Probably the same. Nice!

@arkamar
Copy link
Contributor

arkamar commented Feb 7, 2019

Well, it is still far from perfect, but at least something.

@eldraco
Copy link
Collaborator Author

eldraco commented Feb 19, 2019

Merged! Thanks a lot. It was a good code. I tested it and it worked much better!

@eldraco eldraco closed this as completed Feb 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Advanced Advanced python required help wanted
Projects
None yet
Development

No branches or pull requests

2 participants