Dieses Blog durchsuchen

Mittwoch, 22. April 2015

Sitecore performance: CPU usage of database

Performance and Sitecore is a huge and wide topic. Check Sitecore Performance guideline for more and very detailed information.
I just want to list a few out of my head:
  • check and improve SQL server performance / caching
  • check you architecture
  • may increase number of CDs (Content Delivery Servers)
  • Throw more CPU and RAM on it (only if fully frustrated, better search for the bottleneck)
  • Run Analyzer e.g. google sitespeed, yslow, ….
  • Reduce http request, pack and minify JS and CSS, optimize your frontend
  • Increase Sitecore cache parameters in site config
-       

Today I want to share 2 SQL statements how find your bottlenecks on SQL side:

SELECT DISTINCT TOP 10
t.TEXT QueryName,
s.execution_count AS ExecutionCount,
s.max_elapsed_time AS MaxElapsedTime,
ISNULL(s.total_elapsed_time / 1000 / NULLIF(s.execution_count, 0), 0) AS AvgElapsedTime,
s.creation_time AS LogCreatedOn,
ISNULL(s.execution_count / 1000 / NULLIF(DATEDIFF(s, s.creation_time, GETDATE()), 0), 0) AS FrequencyPerSec
FROM sys.dm_exec_query_stats s
CROSS APPLY sys.dm_exec_sql_text( s.sql_handle ) t
ORDER BY s.max_elapsed_time DESC, ExecutionCount DESC
GO



This is an interesting query showing CPU usage by database

WITH DB_CPU_Stats
AS
(SELECT DatabaseID, DB_Name(DatabaseID) AS [DatabaseName],
  SUM(total_worker_time) AS [CPU_Time_Ms]
FROM sys.dm_exec_query_stats AS qs
CROSS APPLY (SELECT CONVERT(int, value) AS [DatabaseID]
              FROM sys.dm_exec_plan_attributes(qs.plan_handle)
              WHERE attribute = N'dbid') AS F_DB
GROUP BY DatabaseID)
SELECT ROW_NUMBER() OVER(ORDER BY [CPU_Time_Ms] DESC) AS [row_num],
       DatabaseName, [CPU_Time_Ms],
       CAST([CPU_Time_Ms] * 1.0 / SUM([CPU_Time_Ms])
       OVER() * 100.0 AS DECIMAL(5, 2)) AS [CPUPercent]
FROM DB_CPU_Stats
WHERE DatabaseID > 4 -- system databases
AND DatabaseID <> 32767 -- ResourceDB
ORDER BY row_num OPTION (RECOMPILE);

Need more of this. Check here:

Dienstag, 7. April 2015

Sitecore: Uninstalling Sitecore packages

Have you ever installed a Sitecore package? Doesn’t matter if a local one or a bigger one from Sitecore marketplace. I did as well and afterwards I realized that it not suits or had too much errors. It flooding my error log. No how to get rid of those? I searched for a uninstall button, but sadly there is no one. Sitecore CMS does not currently provide an automated way for removing packages installed using the Installation Wizard application.

Possibility 1:

You can only remove packages manually.
The installed packages can be removed manually in the following way:
1.     Extract the installation package to a folder on the file system. A Sitecore package is a standard ZIP archive.
Note:
Usually Sitecore packages contain a package.ZIP file in the original package. This file should also be extracted.
2.      Find the folders called /files and /items in the target location you used when extracting the package.
3.      In the /files folder, you can find the files that get installed with the package.
4.      Match the file paths from the /files folder with the same files in your Sitecore solution and delete or replace them with the original version.
5.      Note:
If the file was overwritten, its old version can be found at the following location:
/temp/installation_history/{GUID}/
For example:
In the extracted package, you have the \SitecoreSomeModule\package\files\bin\Sitecore.SomeModule.dll file.
In the Sitecore solution, navigate to the \Website\bin folder and remove the Sitecore.SomeModule.dll file.
6.      In the /items folder, you can find the items that are installed with the package.
7.      Match file paths from the /items folder with the same items in your Sitecore solution and update them.
Note:
Sitecore does not keep original versions of items when overwriting them

Possibility 2:

A bit weird but, to uninstall packages you need to install another package from Kiran.
You can find it here. After installing it you should be able to uninstall packages automatically.




Main features:
  • You can uninstall your installed package/module (Using original Package file)
  •  Install/Try as many modules you would like to from Sitecore MarketPlace OR from another Sitecore enthusiast!
  • View package details in a tabular format
  • For more information, I would must recommend you to read Package History V2 User Guide


Happy packaging.