performance-optimization | correct common issues in a cloud-based system
kandi X-RAY | performance-optimization Summary
kandi X-RAY | performance-optimization Summary
Guidance on how to observe, measure, and correct common issues in a cloud-based system.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of performance-optimization
performance-optimization Key Features
performance-optimization Examples and Code Snippets
const { Map } = require('immutable');
const map1 = Map({ a: 1, b: 2, c: 3 });
const map2 = Map({ a: 1, b: 2, c: 3 });
map1.equals(map2); // true
map1 === map2; // false
const { Map } = require('immutable');
const map1 = Map({ a: 1, b: 2, c: 3 });
c
Community Discussions
Trending Discussions on performance-optimization
QUESTION
I am from the team that runs nuget.org, the package ecosystem for .NET. We use Azure Search to power our search API. Our APIs are public, so third-party customers can use them to analyze our ecosystem or make apps.
We recently had an outage caused by a single customer paging through our search documents using the $skip and $top query parameters in batches of 200 documents at a time. This resulted in Azure Search throttling:
Failed to execute request because the request rate has caused your service to exceed the limits of its provisioned capacity. Reduce the rate of requests, or adjust the number of replicas/partitions. See http://aka.ms/azure-search-throttling for more information.
Azure Search's throttling affected all customers in that region for 10 minutes, not just the single customer that was paging. We read through Azure Search's throttling documentation, but have the following questions:
- Is customer paging with high $skip values particularly expensive for Azure Search?
- What can we do to reduce the likelihood of Azure Search throttling for paging scenarios?
- Should we add our own throttling to ensure a single customer’s searches doesn’t affect all other customers' searches? Does Azure Search have guidance on this?
Some more information about our service:
- Number of documents in index: ~950K
- Request volume: 1.3K paging requests in ~10 minutes. Peak of 125 requests per second, average of 6 requests per second
- Scale: standard SKU, 1 partition, 3 replicas (this is our secondary region, hence the smaller scale to save money)
ANSWER
Answered 2021-Mar-22 at 23:58Deep paging is indeed a costly operation. Since Azure Search is designed to be distributed, all indexes are divided into multiple shards, to allow for quick scale operation. This comes with the downside that ranked results from each shard need to be merged and ranked to create a final list of results. The number of results to merge increases linearly with the skip value, so that step can become expensive when paging very deep in the results.
As a search service, Azure Search is optimized for quick retrieval of top documents based on textual relevance. It's unfortunately not the best tool for scenarios where a client simply want to return a list of all documents in a data source.
From what I understand in your post, there's 2 reasons for the throttling
- High skip values
- Sharp increase in QPS
We encourage you to control both. It is not uncommon for our customers to implement their own throttling logic to prevent their own customers from emitting an abnormally large amount of requests. Even without skip values, having a single customer send enough queries to increase the traffic multiple-fold can lead to throttling (I'm not sure if that was the case here). There's no official guidelines as to how to handle queries coming from your client apps. The best approach in my opinion would probably be for your team to run performance tests using realistic workloads to try to understand the limits of your search service (which depends on the index schema, number of documents, type of queries being emitted, etc.). Once you have a good idea of how many QPS your service can handle for your scenarios, then you can decide how much of that QPS you are willing to allocate to a single customer at a time, and enforce a limit based on that.
Regarding the deep paging cost: if this is a common scenario for your customers (paging through all documents of a search index), I would recommend you expose a way to page through all documents directly from the data source (assuming Azure Search is not the primary data store of the documents), and mostly use Azure Search for relevance related retrieval scenarios only.
QUESTION
I will have an event with 3k users on an app (php base).
I launch several instances in the cloud and install LAMP on it.[to make load test and choose on for the event]
On Ubuntu 18
I enable mpm_event and php7.4-fpm, (which seems to be the better configuration for high traffic with apache and php app).
I use this post which explain how tune your conf. Like this :
Here apache2 mpm event conf :
...ANSWER
Answered 2021-Feb-15 at 18:23No tool will give you that kind of metric because the best configuration depends greatly on your php scripts. If you have 4 cores and each request consumes 100% of one core for 1 second, the server will handle 4 request per second in the best case regardless of your mpm and php configuration. The type of hardware you have is also important. Some CPUs perform multiple times better than others.
Since you are using php_fpm, the apache mpm configuration will have little effect on performance. You just need to make sure the server doesn't crash with too many requests and have more apache threads than php processes. Note that the RAM is not the only thing that can make a server unreachable. Trying to execute more process than the CPU can handle will increase the load and the number of context switches, decrease the CPU cache efficiency and result in even lower performance.
The ideal number of php processes depends on how your scripts use CPU and other resources. If each script uses 50% of the time with I/O operations for example, 2 processes per core may be ideal. Assuming that those I/O operations can be done in parallel without blocking each other.
You'll also need to take into account the amount of resources used by other processes such as the DB. SQL databases can easily use more resources than the php scripts themselves.
Spare Servers
and Spare Threads
are the number of processes/threads that can be idle waiting for work. Creating threads takes time, so it's better to have them ready when a request arrives. The downside is that those threads will consume resources such as RAM even when idle, so you'll want to keep just enough of them alive. Both apache and php_fpm will handle this automatically. The number of idle threads will be reduced and increased as needed, but remain between the minimum and maximum values set in the configuration. Note that not all apache threads will serve php files as some requests may be fetching static files, therefore you should always have more apache threads than php processes.
Start Server
and Start Threads
represents just the number of processes/threads created during the startup. This have almost no effect on performance since the number of threads will be immediately increased or reduced to fit the values of Spare Threads
.
MaxConnectionsPerChild
and max_requests
are just the maximum amount of requests executed during the process/thread life. Unless you have memory leaks, you won't need to tune those values.
QUESTION
My Server does not serve GZIPd JavaScript files to the client.
I have a Simple Vue.js application, hosted on Heroku. When I build the site via "npm run build" in my console, it populates the /dist/js directory with 4 files for each JavaScript file, as I would expect it to.
So for example:
...ANSWER
Answered 2020-Jun-02 at 11:28The server block is exemplary for NGINX.
When using express, a Node.js compression middleware must be installed.
For Example:
QUESTION
I have two C++ processes that communicate via a memory-mapped Single-Producer Single-Consumer (SPSC) double buffer. The processes will only ever run on Linux/Intel x86-64. The semantics are that the producer fills the front buffer and then swaps pointers and updates a counter, letting the consumer know that it can memcpy()
the back buffer. All shared state is stored in a header block at the start of the mmapped region.
ANSWER
Answered 2020-Apr-21 at 02:17/dev/shm/
is just a tmpfs
mount point, like /tmp
.
Memory you mmap
in files there is normal WB cacheable, just like MAP_ANONYMOUS
. It follows the normal x86 memory-ordering rules (program order + a store buffer with store forwarding) so you don't need SFENCE or LFENCE, only blocking compile-time reordering for acq_rel ordering. Or for seq_cst, MFENCE or a locked operation, like using xchg
to store.
You can use C11 functions on pointers into SHM, for types that are
lock_free
. (Normally any power-of-2 size up to pointer width.)
Non-lock-free objects use a hash table of locks in the address-space of the process doing the operation, so separate processes won't respect each other's locks. 16-byte objects may still use lock cmpxchg16b
which is address-free and works across processes, even though GCC7 and later reports it as non-lock-free for reasons even if you compile with -mcx16
.
I don't think there is a way on a mainstream Linux kernel for user-space to allocate memory of any type other than WB. (Other than the X server or direct-rendering clients mapping video RAM; I mean no way to map ordinary DRAM pages with a different PAT memory type.) See also When use write-through cache policy for pages
Any type other than WB would be a potential performance disaster for normal code that doesn't try to batch stores up into one wide SIMD store. e.g. if you had a data structure in SHM protected by a shared mutex, it would suck if the normal accesses inside the critical section were uncacheable. Especially in the uncontended case where the same thread is repeatedly taking the same lock and reading/writing the same data.
So there's very good reason why it's always WB.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install performance-optimization
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page