Is there a way query and get execution time/metrics for search queries when making a call to Azure Search.
We are looking to log execution times in our app code when each call is made.
Thanks!
You should be able to make use of the documentation on this page: https://learn.microsoft.com/en-us/azure/search/search-monitor-usage to leverage some of the fundamental latency related metrics that Azure search tracks.
In addition, to find out how much time Azure search took to process any particular request, you'll find the elapsed-time header useful. Note that it doesn't include network latency, which you might have to factor in yourself.
If you want to go above and beyond and add analytics for better insights, I'd point you to the Search Traffic Analytics page
Related
I have data in Google datastore. The thing I'm developing makes two http requests to my node.js backend. They both take longer than I'd like. I'm only focusing on trying to improve the response time for one of them (the heaviest request). I modified the node.js code on the backend to time the duration of the GCP datastore query. I've compiled data for 40 calls to the database. I can compile more if you'd like. I put all of the data into an excel spreadsheet, but I've also created images of the information held within, to include in this stackoverflow post. It is included further below.
The size of the payload from the database is only: 1.5 KB according to chrome debugger.
The datastore calls were made once every 3 minutes.
Here is the function that makes the datastore call:
async function listReviews(brand, sku, res) {
const kind = 'ScoredReviewFragment'
const query = datastore.createQuery(brand, kind)
if (brand != 'demo')
query.filter('sku', sku)
const [reviews] = await datastore.runQuery(query)
res.setHeader('Access-Control-Allow-Origin', '*')
res.json(reviews)
}
Personally, I'd love to have the highest total time taken for the datastore call to be sub 100ms. As far as an average database call time, I'd love for that to be 50ms or lower. Is this possible with Google datastore? Am I hoping for too much?
Inside of google chrome debugger, I have looked at these two queries. >98%, or almost 90%, depending on how you measure it, of the time spent from the perspective of the browser is waiting for a response of the server. The download time is almost nothing. Please see included hover-tooltip for the chrome debugger information on the particular database call in question.
The data I compiled in the excel spreadsheet shows the following:
If more information is needed to debug this problem please let me know and I'd be happy to provide it. Help me understand: How do I improve the GCP datastore query response time? Or is there a better way to properly debug the datastore queries?
You can use the best practices listed here as a quick reference as keys-only 1 query is a potentially fastest way to access query results and reduce the latency. However, there are some other good options that you can apply to your system based on your needs. You can still use ‘projection query’2 or replace your offsets to ‘cursor’3, you can find more detailed kind of queries in the following documentation4.
Other best practices5 that should help you to improve the efficiency of your application such as use batch operation performing multiple Cloud Datastore call6.
Be sure to use correct region for your database location. To locate the latency correctly you need to trace the request and measure latency inside your server.
Also if this is mission critical there are other DBs that provide better latency like MemoryStore and BigTable. These are different products with different nature.
I'm looking for throttling information and this is the best that I've been able to find so far: https://learn.microsoft.com/en-us/azure/search/search-limits-quotas-capacity#throttling-limits
For doing a search
https://{{search-service}}.search.windows.net/indexes/:index/docs?api-version={{version}}&search=some text
Is this line from the reference page above the limit for searches?
Get Index (GET /indexes/myindex): 10 per second per search unit
I'm trying to see what the limit is for searching only under ideal scenario of nothing else happening such as an indexer running.
Some APIs such as GET /indexes are throttled based on simple rate limits. However, queries and indexing requests do not work this way. In the case of those APIs, throttling happens dynamically based on resource availability. If the system's internal queues start to fill, requests will begin to fail with 503 (Service Unavailable). If enough such failures happen within a discrete period of time (calculated as an average over a rolling window), the service will throttle requests in order to relieve pressure and allow the system to recover.
The reason throttling works this way instead of based on static rate limits is that most Azure Cognitive Search pricing tiers (other than Free) give you dedicated capacity. Static rate limits could artificially limit how you use your own capacity, so instead throttling dynamically applies backpressure as a way to ensure the reliability of the service when its capacity is overloaded.
For more information about testing and performance tuning Azure Cognitive Search, see this article.
For Azure search, there are 2 kinds of APIs: Query APIs (Search/Suggest/Autocomplete) and Index APIs .
The one you mentioned belongs to Index APIs:
Get Index (GET /indexes/myindex): 10 per second per search unit
If you want to know Query APIs(searching) limit (QPS limit), this doc will be helpful:
I am developng an app with xamarin and azure serverless functions as backend for the app.
I will be syncing map coordinates from the users in real time with a database on the cloud. i.e : taking coordinates from all users and then pushing the updated coordinates to all users at the same time, continuously so that all users can see live location of each other.
So I have to call an azure function in continous loop in order to sync database with cloud. so it can check db after every, 4-5 secs. is it the best way to do this? or will this cause too much execution of azure function and might be costly? If there is a better way to sync the db please suggest. Thankyou.
You have a mobile app that is making http calls to azure functions. Functions is elastic and scale will likely be fine. As I understand, you're not asking how to implement the server side of this; rather the real question here is pricing, right?
Azure Functions can run in two ways:
"serverless", aka "Consumption plan". In this case, Azure Functions is managing the underlying server (and scale out) and you pay only for active usage (per GB*Sec). This is what you get by default when you visit http://functions.Azure.com. See pricing details here: https://azure.microsoft.com/en-us/pricing/details/functions/
"AppService" - In this case, you've bought a VM upfront and you decided how much to scale. You pay a fixed monthly cost. See pricing details here: https://azure.microsoft.com/en-us/pricing/details/app-service/
You can switch between them. I'd recommend starting with the first approach. It will certainly be cheaper in the beginning when you have low traffic. Monitor cost, run your scenarios through the pricing sheets, and consider switching to the 2nd if it ends up being cheaper.
Can Google replenish this resource?
If so, how are subscriptions billed when over quota? Costs?
Anyone else using it for a real life large scale app? (tens or thousands of users/subcriptions?)
New subscriptions will fail when over the subscription quota.
Other quota is still in play but this is a hard ceiling right now.
So, at the time of this writing, unless you plan to keep your number of subscriptions under 10k, you are hosed.
Prospective search is great and I can't wait for it to finally come out of experimental status.
Looking at the documentation here:
The life of a typical prospective search application looks something like this:
You decide on the appropriate document schema. Your choice will depend on the type of source data that the application is designed to handle.
The application uses the subscribe() call to register query subscriptions with prospective search using the query language.
The application converts items in the streaming source data into documents, which are instances of db.Model.
Theapplication uses the match() call to present documents to prospective search for matching against subscribed queries.
Prospective search returns matching subscription IDs and documents in the task queue. These results are subject to the usual Quotas and
Limits.
Based on that, looks like you are only subjected to the quotas limiting Task Queues, which can be found here.
In order to decrease the cost of an existing application which over-consumes on Datastore reads, I am trying to get stats on the application as a whole.
What I'd like to get for the overall application is stats about the queries that are returning the biggest number of rows during a complete day of production. The cost of retrieving data being $0.70 / million, there is a big incentive to optimise / cache some queries but first I have to understand which query retrieves too much data.
Appstats apparently does not provide this information as the tool's primary driver is to optimise one RPC call.
Does anyone has a magic solution for this one ? One alternative I thought about was to build by myself a tool to log after each query the number of rows returned but that looks like an overkill and will require to open the code.
Thanks a lot for your help !
Hugues
See this related post: https://stackoverflow.com/questions/11282567/calculating-datastore-api-usage-per-request/
What you can do to measure and optimize is to look at the cost field provided by the LogService. (It's called cpm_usd in the admin panel).
Using this information you can find the most expensive urls and thus optimize its queries.