JDK8 API Default Concurrecy - java-8

I have to write an API on top of Existing JDK8 Implementation having given the Task to Improve Scalability of Core Java Code.
I have tried using Sleep API which has two arguments, but since the CPU Clock is less accurate, it is of no use.
Can I use Thread Group and use For Loop to Improve Scalability?

Related

OpenModelica FMU for Model Exchange - Parallelized?

Is the FMU for Model Exchange code (generated by OpenModelica) parallelized?
If I want parallelization, must I run different FMUs for Co-Simulation in parallel?
Thanks
Is a bit unclear what you want:
Do you want automatic parallelization of the simulation code inside the FMU?
we have some support for this using OpenMP and also some experimental support using TBB.
Do you want to run the FMUs in parallel on different threads or different processes?
we are working on a tool for FMI co-simulation called OMSimulator which will include some parallelization at the master-algorithm level

Gethbase processor from 1 table Apache NIFI

gethbase >> execute_script
Hello, I have problem with backpressure object threshold when processing data from hbase to executing script with Jython. If just 1 processor is executed, my queue is always full, because the first processor is faster than the second. I was making concurrent tasks of second processor from 1 to 3 or 4 but it makes new error message. Here:
Image
Anyone here has a solution?
This might actually increase your work a bit but I would highly recommend writing Groovy for your custom implementation as opposed to Python/Jython/JRuby.
A couple of reasons for that!
Groovy was built "for the JVM" and leverages/integrates with Java more cleanly
Jython is an implementation of Python for the JVM. There is a lot of back and forth which happen between Python and JVM which can substantially increase the overhead.
If you still prefer to go with Jython, there are still a couple of things that you can do!
Use InvokeScriptedProcessor (ISP) instead of ExecuteScript. ISP is faster because it only loads the script once, then invokes methods on it, rather than ExecuteScript which evaluates the script each time.
Use ExecuteStreamCommand with command-line Python instead. You won't have the flexibility of accessing attributes, processor state, etc. but if you're just transforming content you should find ExecuteStreamCommand with Python faster.
No matter which language you choose, you can often improve performance if you use session.get(int) instead of session.get(). That way if there are a lot of flow files in the queue, you could call session.get(1000) or something, and process up to 1000 flow files per execution. If your script has a lot of overhead, you may find handling multiple flow files per execution can significantly improve performance.

what is the suitable resources for 500 requests per second? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 6 years ago.
Improve this question
the point that every request need some processing. I want to know if my resources enough or I have to upgrade it, or may be I have to test my code and optimize it.
My resources :
4 CPU and 8G ram.
Any outlines, test tools will be appreciated.
If you are serving a static small page - you will be able to serve hundreds of thousands requests per second on that hardware. If you have very "heavy" page which requires lots of server-side processing - it can be just few concurrent users.
I would recommend the following:
Get the load testing tool, for example see Open Source Load Testing Tools: Which One Should You Use? article for comparison.
Set it up to replicate real users as close as possible (headers, cookies, cache, AJAX requests, etc.), virtual users should follow main application use cases
Start with 1-2 virtual users and double check everything works as expected
Gradually increase the load to anticipated number of users and observe system behaviour and main metrics like response time, number of transactions per second, etc. If you are happy with the results - that's it. If not - identify the bottleneck (which is not necessarily your code) and fix it. Repeat. Use profiling tools to inspect your code and identify the most resources consuming parts. Refactor. Repeat.
You can also consider increasing load until your application starts breaking to see what fails first, will the system recover when the load gets back to normal, etc.

Only 100% shown on benchmark run

I was just doing a 10Million insert benchmark to see the performance of a small cache system I'm building. While observing the Activity Monitor I noticed that the main Go process only shows 100% (of the 800%) CPU.
Do I need to split my loops into routines to make it split up to all 8 cores or is there another reason?
I'm not posting code as the test code is not much more than a loop in a testing function in the main body.
Your application is using only one thread so it's correct that there is only one core that run at 100%.
If you want use more than one core you must use more than one go routine, remeber to set GOMAXPROCS shell enviroment or your application will use only one core.
Remember that it's possible that your application could be even slower using more than one process because if your behaviuor is intrinsically sequential you cannot speed up the application just adding more goroutine. You can take a real advantage of multi threading only if your behaviour is intrinsically parallel.

Identify processor (core) is used by specific thread

I would like to know if it is possible to identify physical processor (core) used by thread with specific thread-id?
For example, I have a multithreaded application that has two (2) threads (thread-id = 10 and thread-id = 20, for instance). I run the application on a system that has a dual core processor (core 1 and core 2). So, how do I to get core number used by thread with thread-id = 20?
P.S. Windows platforms.
Thank you,
Denis.
Unless you use thread-affinity, threads are not assigned to specific cores. With every time slice, the thread can be executed on different cores. This means that if there would be a function to get the core of a thread, by the time you get the return value, there's a big chance that the thread is already executing on another core.
If you are using thread-affinity, you could take a look at the Windows thread-affinity functions (http://msdn.microsoft.com/en-us/library/ms684847%28v=VS.85%29.aspx).
There are functions called GetCurrentProcessorNumber (available since Server 2003 and Vista) and GetCurrentProcessorNumberEx (available since Server 2008 R2 and Windows 7).
See also this question's answers for more related options and considerations (including Windows XP - primarily this answer describing the use of cpuid instruction).
Of course the core number can be changed any time by the scheduler so if You need to be sure then perhaps it helps for a reasonable amount if You check the core number both before and after something You measured or executed for a short amount of time, and if the core number is still same then You know on which core most likely the intermediate code also executed.

Resources